Oleg Broytman | 5 Oct 2010 18:15
X-Face
Picon
Favicon

SQLObject 0.14.0b1

Hello!

I'm pleased to announce version 0.14.0b1, the first beta of the upcoming
release of branch 0.14 of SQLObject.

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Where is SQLObject
==================

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

(Continue reading)

Oleg Broytman | 10 Oct 2010 14:17
X-Face
Picon
Favicon

SQLObject 0.14.0

Hello!

I'm pleased to announce version 0.14.0, the first stable release of branch
0.14 of SQLObject.

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Where is SQLObject
==================

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

(Continue reading)

Oleg Broytman | 10 Oct 2010 14:42
X-Face
Picon
Favicon

Re: SQLObject 0.14.0

On Sun, Oct 10, 2010 at 04:17:28PM +0400, Oleg Broytman wrote:
> * The lists of columns/indices/joins are now sorted according to the order
>   of declaration.

   About joins: joinDefinitions list is sorted but joins list is not -
SQLObject stores indices into the list so the list can be reordered without
major internal change.

> * Major API change: attribute 'dirty' was moved to sqlmeta.

   SQLObject is undergoing a period of some major API changes.

Oleg.
--

-- 
     Oleg Broytman            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
Oleg Broytman | 10 Oct 2010 16:11
X-Face
Picon
Favicon

Re: SQLObject 0.14.0

On Sun, Oct 10, 2010 at 04:42:33PM +0400, Oleg Broytman wrote:
> > * The lists of columns/indices/joins are now sorted according to the order
> >   of declaration.
> 
>    About joins: joinDefinitions list is sorted but joins list is not -
> SQLObject stores indices into the list so the list can be reordered without
> major internal change.

   Sorry - ...cannot be reordered...

Oleg.
--

-- 
     Oleg Broytman            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
Georges Schutz | 11 Oct 2010 18:17
Picon
Favicon

Re: SQLObject 0.14.0 - sqlite connection problem

First thank you for all your work.

I tested the new version with my projects using SQLObject and 
encountered the following problem (is the smallest code that reproduces 
the problem).

AttributeError: No connection has been defined for this thread or process

Until at leased version 0.12 this code worked with no problem. I have 
not tested the 0.13 version so I don't know if this behaver was yet in 
the 0.13 version.
This may be a new Features. If so what do I have to do to get the old 
behaviour back where the connection is passed as parameter. I need this 
as I access multiple databases for witch the connection is passed to the 
corresponding class initialisation or even later during runtime of the 
application.

Here the code and the error traceback

#--- Code Begin ---
import sqlobject as sobj

class Person(sobj.SQLObject):
     name = sobj.StringCol(default=None)

conn = sobj.connectionForURI('sqlite:/:memory:')

Person.createTable(ifNotExists=True, connection=conn)
Person(name="P. Dummy", connection=conn)

(Continue reading)

Oleg Broytman | 12 Oct 2010 09:41
X-Face
Picon
Favicon

Re: SQLObject 0.14.0 - sqlite connection problem

Hello!

On Mon, Oct 11, 2010 at 06:17:02PM +0200, Georges Schutz wrote:
> AttributeError: No connection has been defined for this thread or process

   Thank you for the report! I will look at it.

> Until at leased version 0.12 this code worked with no problem. I have 
> not tested the 0.13 version so I don't know if this behaver was yet in 
> the 0.13 version.
> This may be a new Features.

   Seems to be rather a new bug.

Oleg.
--

-- 
     Oleg Broytman            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
Oleg Broytman | 12 Oct 2010 15:39
X-Face
Picon
Favicon

Re: SQLObject 0.14.0 - per-instance connection problem

On Mon, Oct 11, 2010 at 06:17:02PM +0200, Georges Schutz wrote:
> import sqlobject as sobj
> 
> class Person(sobj.SQLObject):
>      name = sobj.StringCol(default=None)
> 
> conn = sobj.connectionForURI('sqlite:/:memory:')
> 
> Person.createTable(ifNotExists=True, connection=conn)
> Person(name="P. Dummy", connection=conn)
> 
> p = Person.selectBy(name = "P. Dummy", connection=conn)
...
>    File 
> "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py", 
> line 850, in getConnection
>      "No connection has been defined for this thread "
> AttributeError: No connection has been defined for this thread or process

   Congratulations, you managed to find quite a subtle problem! Sometimes
validators need additional information from connection - most often
validators need encoding (charset) to convert between str and unicode. In
your example there is no per-class connection, and validators don't get a
connection at all. In many cases it could be fixed - the attached patch is
for testing and discussing.
   The problem is rather old but it manifested itself now because in
version 0.13 I refactored validators' code.

> conn = sobj.connectionForURI('sqlite:/:memory:')
>                                       ^^^^^^^^
(Continue reading)

Georges Schutz | 12 Oct 2010 17:17
Picon
Favicon

Re: SQLObject 0.14.0 - per-instance connection problem

On 12/10/2010 15:39, Oleg Broytman wrote:
> On Mon, Oct 11, 2010 at 06:17:02PM +0200, Georges Schutz wrote:
>> import sqlobject as sobj
>>
>> class Person(sobj.SQLObject):
>>       name = sobj.StringCol(default=None)
>>
>> conn = sobj.connectionForURI('sqlite:/:memory:')
>>
>> Person.createTable(ifNotExists=True, connection=conn)
>> Person(name="P. Dummy", connection=conn)
>>
>> p = Person.selectBy(name = "P. Dummy", connection=conn)
> ...
>>     File
>> "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py",
>> line 850, in getConnection
>>       "No connection has been defined for this thread "
>> AttributeError: No connection has been defined for this thread or process
>
>     Congratulations, you managed to find quite a subtle problem! Sometimes
> validators need additional information from connection - most often
> validators need encoding (charset) to convert between str and unicode. In
> your example there is no per-class connection, and validators don't get a
> connection at all. In many cases it could be fixed - the attached patch is
> for testing and discussing.
>     The problem is rather old but it manifested itself now because in
> version 0.13 I refactored validators' code.
>

(Continue reading)

Oleg Broytman | 12 Oct 2010 17:38
X-Face
Picon
Favicon

Re: SQLObject 0.14.0 - per-instance connection problem

On Tue, Oct 12, 2010 at 05:17:53PM +0200, Georges Schutz wrote:
> --> So for me the patch is OK.

   Thank you for the report!

> >> conn = sobj.connectionForURI('sqlite:/:memory:')
> >>                                        ^^^^^^^^
> >> Person.createTable(ifNotExists=True, connection=conn)
> >                       ^^^^^^^^^^^^^^^^
> >     I seems you prepared memory to be rather persistent! (Just kidding.)
> 
> Sorry, for that non necessary part of code. I, simply used code from a 
> part of my project where a sqlite file is used and  forgot to remove 
> this part.

   I was only joking, really. (-:

> Thanks for your rapid reaction. Will this patch automatically be part of 
> the next releases or is it necessary to fill a bug report?

   Sure, it will be. SQLObject is not such a big project to require Special
Bureaucratic Procedures.

Oleg.
--

-- 
     Oleg Broytman            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
(Continue reading)

Octav Chipara | 13 Oct 2010 23:28
Picon

q-magic + multiple connections


Hi,

I'm trying to use the "q-magic" and multiple connections to run a query such as the following:

Person.select(Person.q.object_id =="con1", connection = sql_con1)

However, I'm getting the following exception:

  File "/Users/ochipara/Working/workspace/wiisardpy/provider/junk/test_multipleconnections.py", line 29, in <module>
    print Person.select(Person.q.object_id =="con1", connection= sql_con1)
  File "/Library/Python/2.6/site-packages/SQLObject-0.13.0-py2.6.egg/sqlobject/sqlbuilder.py", line 346, in __eq__
    other = self._from_python(other)
  File "/Library/Python/2.6/site-packages/SQLObject-0.13.0-py2.6.egg/sqlobject/sqlbuilder.py", line 341, in _from_python
    value = column.from_python(value, SQLObjectState(self.soClass))
  File "/Library/Python/2.6/site-packages/SQLObject-0.13.0-py2.6.egg/sqlobject/col.py", line 501, in to_python
    connection = state.soObject._connection
  File "/Library/Python/2.6/site-packages/SQLObject-0.13.0-py2.6.egg/sqlobject/dbconnection.py", line 837, in __get__
    return self.getConnection()
  File "/Library/Python/2.6/site-packages/SQLObject-0.13.0-py2.6.egg/sqlobject/dbconnection.py", line 850, in getConnection
    "No connection has been defined for this thread "
AttributeError: No connection has been defined for this thread or process
Exception AttributeError: "'NoneType' object has no attribute 'print_exc'" in <function _removeReceiver at 0x1004e3398> ignored


Is there a way to use the q-magic over multiple connections?

Thanks,
-- Octav

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Gmane