[sqlalchemy] Problems with back_ports

2010-10-07 Thread Richard Poettler
Hi, I am trying to get my back_ports working since one day, and doesn't seem to miss something there. In my example i am trying to allow one author to have one note at maximum and one note to have at maximum one author. If one author has a note the corresponding entries should reference each

Re: [sqlalchemy] Session problems

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 12:53 AM, Warwick Prince wrote: Hi Michael I'm still having a couple of issues with the sessions, but I'm now starting to suspect mysqlconnector.. For completeness, could you please let me know if there is anything specific I need to do to close down a session /

Re: [sqlalchemy] Problems with back_ports

2010-10-07 Thread Richard Pöttler
Ok, i got my mapping wrong. The new one is: = mapper(Author, author_table, properties={ 'note': relationship(Note, back_populates='author', uselist=False, primaryjoin=author_table.c.note_id==note_table.c.id,

Re: [sqlalchemy] Problems with back_ports

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 10:02 AM, Richard Pöttler wrote: Ok, i got my mapping wrong. The new one is: = mapper(Author, author_table, properties={ 'note': relationship(Note, back_populates='author', uselist=False,

[sqlalchemy] Re: Optimizing performance of hierarchical data structure loading

2010-10-07 Thread Alec Munro
Well, I finally had the time to try this out, and after a little fiddling, I cut my time in half. I still think there must be further optimization options (what David suggested probably won't work for our purposes, but I may look into it), as when I only load the first level of data, which is 6K,

[sqlalchemy] missing bind parameters don't raise exceptions

2010-10-07 Thread Chris Withers
Hi, I'd expect this: session.execute( 'select * from foo where bar=:baz', {} ) ...to raise an exception. It doesn't, why not? Chris -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

Re: [sqlalchemy] missing bind parameters don't raise exceptions

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 10:54 AM, Chris Withers wrote: Hi, I'd expect this: session.execute( 'select * from foo where bar=:baz', {} ) ...to raise an exception. It doesn't, why not? Session.execute() creates text(), and text() creates a bindparam() object for :baz which has a

Re: [sqlalchemy] Problems with back_ports

2010-10-07 Thread Richard Pöttler
On Thu, Oct 7, 2010 at 4:22 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 7, 2010, at 10:02 AM, Richard Pöttler wrote: Ok, i got my mapping wrong. The new one is: = mapper(Author, author_table, properties={    'note':

Re: [sqlalchemy] Problems with back_ports

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 11:13 AM, Richard Pöttler wrote: On Thu, Oct 7, 2010 at 4:22 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 7, 2010, at 10:02 AM, Richard Pöttler wrote: Ok, i got my mapping wrong. The new one is: =

Re: [sqlalchemy] missing bind parameters don't raise exceptions

2010-10-07 Thread Chris Withers
On 07/10/2010 16:01, Michael Bayer wrote: It doesn't, why not? Session.execute() creates text(), and text() creates a bindparam() object for :baz which has a value of None by default. Do it like this if you like: session.execute( text(select * from foo where bar=:baz,

[sqlalchemy] Updating attributes of an instance

2010-10-07 Thread Alok G. Singh
Is there an elegant way of replacing all the attributes of an instance, except the primary key ? Currently, I create a new object with all the date, fetch the old object and do for k,v in new: old.__setattr__(k, v), taking care to skip the primary key attribute. There's a custom __iter__ method

Re: [sqlalchemy] Updating attributes of an instance

2010-10-07 Thread Michael Bayer
On Oct 7, 2010, at 5:37 AM, Alok G. Singh wrote: Is there an elegant way of replacing all the attributes of an instance, except the primary key ? Currently, I create a new object with all the date, fetch the old object and do for k,v in new: old.__setattr__(k, v), taking care to skip the