[sqlalchemy] Association Object creation

2011-11-23 Thread Enrico Morelli
Dear all, I have to create an association object that have to relate elements of the same table. These are the table definition: ligand_table = Table('ligand', metadata, Column('id', types.Integer, primary_key=True), Column('number', types.Integer, nullable=False), Column('name',

Re: [sqlalchemy] Association Object creation

2011-11-23 Thread Enrico Morelli
On Wed, 23 Nov 2011 10:59:03 +0100 Enrico Morelli more...@cerm.unifi.it wrote: These are the mappers: mapper(Ligand, ligand_table, properties={ 'ligand':relationship(LigandLigand, primaryjoin=and_(ligand_table.c.id==ligand_ligand_table.c.ligand_id1,

Re: [sqlalchemy] add results in a python object

2011-11-23 Thread Wichert Akkerman
On 11/17/2011 01:42 PM, raulna wrote: Hi, i need save results in a python object from multiples querys, like: for user in users: phones = DBSession.query(Phone).filter('... python_object = python_object + phones ? How can i append this results in

[sqlalchemy] sqlalchemy memory usage

2011-11-23 Thread lestat
if I do for x in xrange(1): u = User.query.get(x) that python process memory up to 70 mb, and after cycle I try do db.session.close_all() or db.session.expire_all() but process memory not clear and it still 70 mb. If I working with millions of objects and try clearing memory, it use

Re: [sqlalchemy] Association Object creation

2011-11-23 Thread Michael Bayer
On Nov 23, 2011, at 5:20 AM, Enrico Morelli wrote: On Wed, 23 Nov 2011 10:59:03 +0100 Enrico Morelli more...@cerm.unifi.it wrote: These are the mappers: mapper(Ligand, ligand_table, properties={ 'ligand':relationship(LigandLigand,

Re: [sqlalchemy] sqlalchemy memory usage

2011-11-23 Thread Michael Bayer
Python processes in CPython don't release memory back to the OS. On Nov 23, 2011, at 10:14 AM, lestat wrote: if I do for x in xrange(1): u = User.query.get(x) that python process memory up to 70 mb, and after cycle I try do db.session.close_all() or

[sqlalchemy] Re: Translating T-SQL UPDATE FROM to SQLAlchemy

2011-11-23 Thread Andrew Buza
On Nov 21, 11:47 am, Michael Bayer mike...@zzzcomputing.com wrote: I can tell you that there are two trac tickets regarding this functionality, and this patch in particular has a @compiles recipe that does the basic idea: http://www.sqlalchemy.org/trac/attachment/ticket/1944/enhance2.py

Re: [sqlalchemy] Re: Translating T-SQL UPDATE FROM to SQLAlchemy

2011-11-23 Thread Michael Bayer
On Nov 23, 2011, at 6:50 PM, Andrew Buza wrote: On Nov 21, 11:47 am, Michael Bayer mike...@zzzcomputing.com wrote: I can tell you that there are two trac tickets regarding this functionality, and this patch in particular has a @compiles recipe that does the basic idea: