Re: [sqlalchemy] session memory management

2011-12-05 Thread Michael Bayer
On Dec 5, 2011, at 1:40 AM, kris wrote: I have added the flush every 1024 loads, and also set DBSession.autoflush = False, but I see that I have gone and used up all available memory again. There are no other references than the ones in the session. A bit more information, I am

[sqlalchemy] Parent of the parent (relationship) as a hybrid property

2011-12-05 Thread Daniel Nouri
Say I have a class that derives from a Node class that has a 'parent' relationship (using 'parent_id' and 'id' fields): from sqlalchemy.ext.hybrid import hybrid_property class MyClass(Node): @hybrid_property def grandparent(self): return self.parent.parent

Re: [sqlalchemy] Parent of the parent (relationship) as a hybrid property

2011-12-05 Thread Michael Bayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 5, 2011, at 11:58 AM, Daniel Nouri wrote: Say I have a class that derives from a Node class that has a 'parent' relationship (using 'parent_id' and 'id' fields): from sqlalchemy.ext.hybrid import hybrid_property class

Re: [sqlalchemy] Parent of the parent (relationship) as a hybrid property

2011-12-05 Thread Daniel Nouri
On Mon, Dec 5, 2011 at 6:42 PM, Michael Bayer mike...@zzzcomputing.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 5, 2011, at 11:58 AM, Daniel Nouri wrote: Say I have a class that derives from a Node class that has a 'parent' relationship (using 'parent_id' and 'id'

Re: [sqlalchemy] Parent of the parent (relationship) as a hybrid property

2011-12-05 Thread Michael Bayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Dec 5, 2011, at 1:39 PM, Daniel Nouri wrote: Thanks for your explanation. I haven't used hybrid a lot yet and this helped me understand what it does and what not. Your last example that uses a 'with_transformation', i.e. a protocol that

[sqlalchemy] Complex foreign key constraint

2011-12-05 Thread Jackson, Cameron
I have two tables, SystemVariables and VariableOptions. SystemVariables is self-explanatory, and VariableOptions contains all of the possible values for all of the variables. VariableOptions has a foreign key, variable_id, which states which variable it is an option for. SystemVariables has a

Re: [sqlalchemy] Complex foreign key constraint

2011-12-05 Thread Michael Bayer
On Dec 5, 2011, at 7:40 PM, Jackson, Cameron wrote: I have two tables, SystemVariables and VariableOptions. SystemVariables is self-explanatory, and VariableOptions contains all of the possible values for all of the variables. VariableOptions has a foreign key, variable_id, which states

RE: [sqlalchemy] Complex foreign key constraint

2011-12-05 Thread Jackson, Cameron
Thanks Mike. Might put this on the back-burner for now, and I'll look into it again when I get the time. Cheers. Cameron Jackson Engineering Intern Air Operations Thales Australia Thales Australia Centre, WTC Northbank Wharf, Concourse Level, Siddeley Street, Melbourne, VIC 3005, Australia Tel:

Re: [sqlalchemy] Digest for sqlalchemy@googlegroups.com - 3 Messages in 2 Topics

2011-12-05 Thread Rivka Shenhav
Michael, Thanks so much for your prompt answer. Instead of going into the extensive details of my program - I decided to abstract from it and just try to get down the basic operations of the construct. So - I wrote a very simple tutorial that pretty much implements what the documentation

Re: [sqlalchemy] Digest for sqlalchemy@googlegroups.com - 3 Messages in 2 Topics

2011-12-05 Thread Michael Bayer
On Dec 5, 2011, at 9:57 PM, Rivka Shenhav wrote: Michael, Thanks so much for your prompt answer. Instead of going into the extensive details of my program - I decided to abstract from it and just try to get down the basic operations of the construct. So - I wrote a very simple tutorial

RE: [sqlalchemy] Complex foreign key constraint

2011-12-05 Thread Jackson, Cameron
Just to follow up on this again: I asked the question at Stack Overflow as well, and someone showed me how I can accomplish this in SQL using a compound foreign key: http://stackoverflow.com/a/8395021/665488 Now I just have to convert his SQL into SQLAlchemy declarative syntax and I'll have a