[sqlalchemy] Re: Info needed regarding the use of cascade
I got you now Thank you Simon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] UnboundExecutionError and lazyness
I've hit the problem explained here: http://groups.google.com/group/sqlalchemy/msg/499a0765d426e12b but I didn't quite understand how to work around it. I have a series of mappings relations with lazy=True and one of them in some situations seems having that problem. To be honest everything worked fine with lazy=False, I just tried to make it lazy to avoid some situations in which the ORM does the wrong (and more resource painful) query. It is a self referential mapping: mapper(Job, job, properties=dict( tasks=relation(JobDetail, lazy=False, backref='job'), conf=relation(Configuration, lazy=False))) mapper(JobDetail, jobdetail) parent_rel = relation( Configuration, lazy=False, join_depth=5, # No more than 5 hierarchy levels remote_side=[configuration.c.config_name]) parameters_rel = relation( _ConfigurationDetail, lazy=False, collection_class=column_mapped_collection(configuration_detail.c.param_name), cascade='all, delete-orphan') mapper(Configuration, configuration, properties = dict(_parent=configuration.c.parent, parent=parent_rel, parameters=parameters_rel)) Turning the lazy argument from False to True makes this error appear: UnboundExecutionError: Parent instance Configuration at 0x8ce466c is not bound to a Session; lazy load operation of attribute 'parent' cannot proceed In the meantime I've fixed the the resource painful query using options(lazyload('property')) but I'd really like to understand what's going on. Does someone have an idea? -- Lawrence, neropercaso.it - oluyede.org It is difficult to get a man to understand something when his salary depends on not understanding it - Upton Sinclair --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Data logging and many-to-many's
Quite complicated, I see X-) Anyway, I've been able to implement the clean way you suggested (or at least the test suite says so :) ).. Many thanks again for your time, you've been very helpful! (Thanks to Svil too for your contribution!) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Insert Column
How to insert a column between two columns in MS SQL? Not in MYSQL eg: if in table ABC a and b are column and I want to insert c column between a and b column. One way to drop b column first then add c then again insert b but that is not safe (if data not empty). Is there any Query in MS SQL similar to MYSQL? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] confused about how functions work
table.update(criterion, values={'last_edited' : func.now()} ).execute () works but table.update(criterion ).execute({'last_edited' : func.now()}) does not. It tries to set 'last_edited' to functions object. Can someone clarify the difference ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: confused about how functions work
turn echo/logging on and see the difference. one embeds it in the statement, another comes as runtime bind-param. i guess u cannot give funcs as bind-parameters (runtime) ?? On Thursday 20 November 2008 14:42:16 Moshe C. wrote: table.update(criterion, values={'last_edited' : func.now()} ).execute () works but table.update(criterion ).execute({'last_edited' : func.now()}) does not. It tries to set 'last_edited' to functions object. Can someone clarify the difference ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Insert Column
Hi On Thu, Nov 20, 2008 at 12:45 AM, Rohith [EMAIL PROTECTED] wrote: How to insert a column between two columns in MS SQL? Not in MYSQL eg: if in table ABC a and b are column and I want to insert c column between a and b column. One way to drop b column first then add c then again insert b but that is not safe (if data not empty). Is there any Query in MS SQL similar to MYSQL? As far as I know you cannot purposefully order the columns through MSSQL except through the admin interface where you can drag them around. The reason this works through the admin is that it's actually dropping and recreating the table and migrating the data from a temp spot. You can see all this happening by scripting out the change before applying it. I guess the real question is, why does matter? Michael --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: confused about how functions work
in one case the update() statement is constructed knowing the VALUES clause ahead of time so that it can render the NOW() function. In the latter case, execute() compiles the update() statement passing along the key names of the given parameters but not the values, which are all assumed to be bind parameters. its primarily an implementation detail for internal performance purposes. Moshe C. wrote: table.update(criterion, values={'last_edited' : func.now()} ).execute () works but table.update(criterion ).execute({'last_edited' : func.now()}) does not. It tries to set 'last_edited' to functions object. Can someone clarify the difference ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: UnboundExecutionError and lazyness
Lawrence Oluyede wrote: UnboundExecutionError: Parent instance Configuration at 0x8ce466c is not bound to a Session; lazy load operation of attribute 'parent' cannot proceed the error means simply this: x = session.query(X).get(5) del session # or session.clear(), session.expunge(x), etc. print x.child_items the child_items is being asked to issue a Query to the database for related items, but no Session is present with which to establish transactional context. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] tometadata for declarative
Is there any sort of tometadata for the declarative layer in sqlalchemy? If I have a declarative class, I want to be able re-create that class for another metadata. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: tometadata for declarative
this can only be done as far as the Table object. the mapper() and declarative base class doesn't have any kind of clone method: newtable = MyClass.__table__.tometadata(somemetadata) class MyNewClass(SomeBase): __table__ = newtable mg wrote: Is there any sort of tometadata for the declarative layer in sqlalchemy? If I have a declarative class, I want to be able re-create that class for another metadata. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Insert.params() broken?
Sorry for double posting. I pressed Send before I was ready... Please let me know if I'm doing something wrong here: [code] metadata = MetaData('sqlite:///first.sqlite') table = Table('my_table', metadata, Column('text', Unicode(16))) stmt = table.insert() parameters=dict(text='Hello, World!') print stmt.compile().params print stmt.params(parameters).compile().params [/code] The first print gives: {'text': None} The second crashes with: File /tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py, line 3515, in _copy_internals self.parameters = self.parameters.copy() AttributeError: 'NoneType' object has no attribute 'copy' After doing this patch: [patch] --- /tool/tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/ expression.py.orig2008-11-20 15:13:38.080922000 -0800 +++ /tool/tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py 2008-11-20 15:13:57.008589000 -0800 @@ -3511,8 +3511,8 @@ return () def _copy_internals(self, clone=_clone): -# TODO: coverage -self.parameters = self.parameters.copy() +if self.parameters is not None: +self.parameters = self.parameters.copy() @_generative def prefix_with(self, clause): [/patch] I get {'text': None} for the second print too. I took this directly from the docs at sqlalchemy.sql.expression.Insert.params. Should I use 0.4 instead? Is it more stable / less broken? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] ORM mapping with Elixir compared to raw cursor query
Hi, I've made this post already on my blog but it was suggested i post here as it might be an interesting point of discussion. The first scenario is a single table with 24,000 rows. The problem is that using SQLAlchemy through Elixir to map this table to an object, and performing a fairly naive MappedThing.query().all() the process takes roughly 4.8 seconds to return every item! Compared to 0.3 seconds total time taken to get and store every row in a tuple using MysqlDb and a cursor. Furthermore, when i attempt to use the object as i'd actually want in practise, i.e. join the values of this 24,000 row table to appropriate other tables as defined by the database's foreign keys, the whole process takes a really long time, running a very inefficient join query taking roughly 10 seconds to complete. Again this is compared to a set of queries taking under 1 second in pure SQL The scenario where i'd want such a query where i get all the data is primarily administrative and subsequently arguably it doesn't matter if its slow. However similarly unusable speeds are found even when running slightly cut down versions for users. My solution at the moment is to simply use SQLAlchemy as a glorified MysqlDb connection with a very fancy SQL statement generation library. I'd like to use the ORM sides more but with these speeds i'm not sure i can! The question is, is SQLAlchemy supposed to be this slow? Is this the cost of wanting your data as objects? Has anyone else got experience with SQLAlchemy working with larger databases and if so how does it fair on such queries? Are they just avoided entirely or am i just approaching this problem from the wrong direction, in which case any advice would be much appreciated! Thanks The specific code and setup i have can be found here: http://www.sinjax.net/wordpress/?p=1652 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Insert.params() broken?
I expect I'm doing this wrong, but it seems broken to me. Please let me know. Here's what I'm doing: stmt = metadata.tables['tf_user'].insert() parameters=dict(id=1,user_name='bgolemon',password='badpass',display_name='Buck Golemon',created=None) print stmt.compile().params print stmt.params(parameters).compile().params --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Insert.params() broken?
On Nov 20, 2008, at 6:16 PM, bukzor wrote: The second crashes with: File /tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py, line 3515, in _copy_internals self.parameters = self.parameters.copy() AttributeError: 'NoneType' object has no attribute 'copy' insert.params() was not the intended usage of the params() feature. In r5313 I've added NotImplementedError when params() is called on all Insert/Update/Delete constructs, since this feature is intended for generative modification of select() statements and other clause fragments. In this case you almost certainly mean to say insert.values(**params). The feature can be implemented for I/U/D but would require test coverage, but also is concerning since the params() method modifies all clause elements and is much more expensive than just calling values(). I'd be concerned that people would inadvertently use it without realizing that they really want to be calling values(). Should I use 0.4 instead? Is it more stable / less broken? there is no difference in 0.4 with regards to this behavior (except that in 0.5, now its covered). 0.5 is overall much more stable/ performant than 0.4 and is very close to final release. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: ORM mapping with Elixir compared to raw cursor query
On Nov 20, 2008, at 7:07 PM, SinJax wrote: Hi, I've made this post already on my blog but it was suggested i post here as it might be an interesting point of discussion. The first scenario is a single table with 24,000 rows. The problem is that using SQLAlchemy through Elixir to map this table to an object, and performing a fairly naive MappedThing.query().all() the process takes roughly 4.8 seconds to return every item! Compared to 0.3 seconds total time taken to get and store every row in a tuple using MysqlDb and a cursor. Furthermore, when i attempt to use the object as i'd actually want in practise, i.e. join the values of this 24,000 row table to appropriate other tables as defined by the database's foreign keys, the whole process takes a really long time, running a very inefficient join query taking roughly 10 seconds to complete. Again this is compared to a set of queries taking under 1 second in pure SQL The scenario where i'd want such a query where i get all the data is primarily administrative and subsequently arguably it doesn't matter if its slow. However similarly unusable speeds are found even when running slightly cut down versions for users. My solution at the moment is to simply use SQLAlchemy as a glorified MysqlDb connection with a very fancy SQL statement generation library. I'd like to use the ORM sides more but with these speeds i'm not sure i can! The question is, is SQLAlchemy supposed to be this slow? Is this the cost of wanting your data as objects? Has anyone else got experience with SQLAlchemy working with larger databases and if so how does it fair on such queries? Are they just avoided entirely or am i just approaching this problem from the wrong direction, in which case any advice would be much appreciated! SQLAlchemy's ORM is extremely fast, and in particular is super- optimized for fetching rows. However, an ORM is by nature much slower than a raw cursor. A discussion of this can be found here: http://techspot.zzzeek.org/?p=17 .Note also that SQLA 0.5 is a further 15% faster when fetching ORM rows than the 0.4 version profiled there. The only faster ORM in Python is Storm when used with their newly released C extensions, which allows it to fetch ORM rows as fast as SQLAlchemy's ResultProxy. Without their C extension in use, SQLA 0.5 is about 40% faster. Needless to say C extensions are also on the roadmap for SQLAlchemy so we hope to catch up to them again hopefully within the next year. But in general, SQLAlchemy's ORM is considered to be quite performant, and the wiki lists about a dozen websites currently using it. As far as the joins issued, its not possible to comment on that without seeing what joins in question you're referring to, or if you're referring to the contrast between a JOIN and just issuing individual SELECT statements for each row fetched in the primary result set. The SQLA ORM renders joins using select * from tablea JOIN tableb ON criterion, so there is no extra inefficiency introduced in that use case versus a hand-rendered join. But overall, ORMs are designed to be used for fine-tuned persistence/ query operations with a high degree of automation, and not bulk operations such as dumping an entire table of 24,000 rows. This is why SQLAlchemy offers two levels of functionality, the ORM as well as the SQL expression language, which compiles whatever SQL you want and returns rows wrapped in ResultProxy objects, which are thin layers on top of cursor objects that provide convenience functionality as well as Python type conversion. If you are dealing with many thousands of rows, this is the appropriate API to be used, introducing relatively minimal overhead versus a raw cursor, with variability introduced by how many row-processing TypeEngine objects are in use. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Insert.params() broken?
When you say generative, do you mean it returns a new object, as opposed to in-place changes? Would it make sense to rename Insert.values to Insert.params? Or make Insert.params call Insert.values. It seems quite strange for an object to have functions that aren't usable... Different, but related question: How do I print out the statement in copy-paste-able format? More specifically, how do i get an ordered list of bound values out of the statement? This code does what I want, but it's really clunky and fragile: def print_statement(stmt): s = str(stmt).replace(?, %s) from re import search args = search(\((.*?)\), s).group(1).split(, ) print s % tuple(repr(stmt.params[arg]) for arg in args) On Nov 20, 5:29 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Nov 20, 2008, at 6:16 PM, bukzor wrote: The second crashes with: File /tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py, line 3515, in _copy_internals self.parameters = self.parameters.copy() AttributeError: 'NoneType' object has no attribute 'copy' insert.params() was not the intended usage of the params() feature. In r5313 I've added NotImplementedError when params() is called on all Insert/Update/Delete constructs, since this feature is intended for generative modification of select() statements and other clause fragments. In this case you almost certainly mean to say insert.values(**params). The feature can be implemented for I/U/D but would require test coverage, but also is concerning since the params() method modifies all clause elements and is much more expensive than just calling values(). I'd be concerned that people would inadvertently use it without realizing that they really want to be calling values(). Should I use 0.4 instead? Is it more stable / less broken? there is no difference in 0.4 with regards to this behavior (except that in 0.5, now its covered). 0.5 is overall much more stable/ performant than 0.4 and is very close to final release. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Invalid SQL for not None on relation attributes
I'm getting invalid SQL when I try to filter for records that have no matching related record in a one-to-one relationship using the not_ function. For example, with address being a relation from User: print User.id==None users.id IS NULL print not_(User.id==None) users.id IS NOT NULL print User.address==None users.address_id IS NULL print not_(User.address==None) users.address_id != NULL The last expression fails to return the correct records against MySQL. Below is a complete test script to reproduce the above output: from sqlalchemy import create_engine, Table, Column, Integer, String, Text, \ MetaData, ForeignKeyConstraint, not_ from sqlalchemy.orm import mapper, relation, sessionmaker # initialize the engine engine = create_engine('sqlite:///:memory:', echo=False) metadata = MetaData() # setup the users table users = Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String(50)), Column('address_id', Integer), ForeignKeyConstraint(['address_id'], ['addresses.id']) ) # setup the addresses table addresses = Table('addresses', metadata, Column('id', Integer, primary_key=True), Column('address', Text), ) # create the tables metadata.create_all(engine) # define the User class class User(object): def __repr__(self): return 'User %s' % self.name # define the Address class class Address(object): def __repr__(self): return 'Address %s' % self.address # setup the mapping mapper(Address, addresses) mapper(User, users, properties={ 'address': relation(Address, backref='user') }) # create the session Session = sessionmaker(bind=engine) # perform the tests print User.id==None print not_(User.id==None) print User.address==None print not_(User.address==None) A possible fix seems to be to add binary.negate = operators.isnot below lines 394 and 397 of orm/strategies.py --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Insert.params() broken?
On Nov 20, 2008, at 9:05 PM, bukzor wrote: When you say generative, do you mean it returns a new object, as opposed to in-place changes? Would it make sense to rename Insert.values to Insert.params? Or make Insert.params call Insert.values. It seems quite strange for an object to have functions that aren't usable... its an entirely different function. If you said this: t = table.update().where(table.c.col1==bindparam('x', value=5)) Saying this: t2 = t.params('x', 12) would in theory produce (with bind values inlined) UPDATE table WHERE x=12 while saying this: t3 = t.values('x', 12) would produce UPDATE TABLE SET x=12 WHERE x=5 for an INSERT, the difference would apply to bind params that are perhaps embedded in subqueries within the VALUES clause. As I said before, params() could be implemented for insert/update/ delete, but I think its better that this particular confusion is not possible. A different name for params() in version 0.6, perhaps. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Invalid SQL for not None on relation attributes
very nice - this fix is applied in r5314. It's not every day someone gives us a patch for strategies.py...have any more ? :) On Nov 20, 2008, at 9:47 PM, Yoann Roman wrote: I'm getting invalid SQL when I try to filter for records that have no matching related record in a one-to-one relationship using the not_ function. For example, with address being a relation from User: print User.id==None users.id IS NULL print not_(User.id==None) users.id IS NOT NULL print User.address==None users.address_id IS NULL print not_(User.address==None) users.address_id != NULL The last expression fails to return the correct records against MySQL. Below is a complete test script to reproduce the above output: from sqlalchemy import create_engine, Table, Column, Integer, String, Text, \ MetaData, ForeignKeyConstraint, not_ from sqlalchemy.orm import mapper, relation, sessionmaker # initialize the engine engine = create_engine('sqlite:///:memory:', echo=False) metadata = MetaData() # setup the users table users = Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String(50)), Column('address_id', Integer), ForeignKeyConstraint(['address_id'], ['addresses.id']) ) # setup the addresses table addresses = Table('addresses', metadata, Column('id', Integer, primary_key=True), Column('address', Text), ) # create the tables metadata.create_all(engine) # define the User class class User(object): def __repr__(self): return 'User %s' % self.name # define the Address class class Address(object): def __repr__(self): return 'Address %s' % self.address # setup the mapping mapper(Address, addresses) mapper(User, users, properties={ 'address': relation(Address, backref='user') }) # create the session Session = sessionmaker(bind=engine) # perform the tests print User.id==None print not_(User.id==None) print User.address==None print not_(User.address==None) A possible fix seems to be to add binary.negate = operators.isnot below lines 394 and 397 of orm/strategies.py --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---