From: Oleg B. <ph...@ph...> - 2010-10-10 12:17:44
|
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 Download: http://pypi.python.org/pypi/SQLObject/0.14.0 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.13 --------------- Features & Interface ~~~~~~~~~~~~~~~~~~~~ * The lists of columns/indices/joins are now sorted according to the order of declaration. * ``validator2`` was added to all columns; it is inserted at the beginning of the list of validators, i.e. its ``from_python()`` method is called first, ``to_python()`` is called last, after all validators in the list. * SQLiteConnection's parameter ``use_table_info`` became boolean with default value True; this means the default schema parser is now based on ``PRAGMA table_info()``. * Major API change: attribute 'dirty' was moved to sqlmeta. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-10-10 12:42:48
|
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/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-10-10 14:11:46
|
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/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Georges S. <geo...@in...> - 2010-10-12 06:30:18
|
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) p = Person.selectBy(name = "P. Dummy", connection=conn) #--- Code End --- Traceback (most recent call last): File "D:\eclipse3.6WS\test_python\dbSQLObject_conn_error_small.py", line 11, in <module> p = Person.selectBy(name = "P. Dummy", connection=conn) File "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\main.py", line 1377, in selectBy conn._SO_columnClause(cls, kw), File "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py", line 585, in _SO_columnClause value = col.from_python(value, sqlbuilder.SQLObjectState(soClass)) File "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\col.py", line 506, in to_python connection = state.soObject._connection File "C:\Python26\lib\site-packages\sqlobject-0.14.0-py2.6.egg\sqlobject\dbconnection.py", line 837, in __get__ return self.getConnection() 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 |
From: Oleg B. <ph...@ph...> - 2010-10-12 07:42:12
|
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/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-10-12 13:39:45
Attachments:
connection.patch
|
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:') > ^^^^^^^^ > Person.createTable(ifNotExists=True, connection=conn) ^^^^^^^^^^^^^^^^ I seems you prepared memory to be rather persistent! (Just kidding.) Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Georges S. <geo...@in...> - 2010-10-12 15:18:24
|
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. > I applied the attached patch to my 0.14 version which worked with some shift operations. I suppose you did your patch on the head of the trunk. After patching I tested it on the small example code (OK) and on the larger project (at leased on parts of it) and every thing worked as usual, no error any more. --> So for me the patch is OK. >> 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. > > Oleg. > > Thanks for your rapid reaction. Will this patch automatically be part of the next releases or is it necessary to fill a bug report? Georges Schutz > > ------------------------------------------------------------------------------ > 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 > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |
From: Oleg B. <ph...@ph...> - 2010-10-12 15:38:30
|
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/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |