[sqlalchemy] Re: Memory leak - is session.close() sufficient?

2008-11-07 Thread Michael Bayer
On Nov 7, 2008, at 6:21 AM, joelanman wrote: Hi, I'm getting a memory leak with my app - the stack is apache2, mod_wsgi, web.py - and then a lot of sqlalchemy and my own code. The issue may well not be with my usage of SQLA - just making sure there's nothing I might be doing wrong with

[sqlalchemy] Re: persistent result set

2008-11-07 Thread Michael Bayer
On Nov 6, 2008, at 8:29 PM, Adam Ryan wrote: Wow, this is great stuff. I'll have to spend some time trying it out. My big question, though, is how to interact with this stored query using and_ and or_? I went off on a different track where I would store a list of filter objects with

[sqlalchemy] Re: Memory leak - is session.close() sufficient?

2008-11-07 Thread joelanman
Thanks for that - I'll check out those options - I am using Beaker for cache and sessions. In the meantime I found this post about a leak in MySQLdb 1.2.2 when using charset=UTF8, which I am: http://jjinux.blogspot.com/2008/09/python-debugging-memory-leaks.html I'm using SQLA to do all

[sqlalchemy] Re: Memory leak - is session.close() sufficient?

2008-11-07 Thread Michael Bayer
On Nov 7, 2008, at 10:17 AM, joelanman wrote: Thanks for that - I'll check out those options - I am using Beaker for cache and sessions. OK, with Beaker, if you are caching things on a dynamically generated key, such as a key constructed from arbitrary parameters, I strongly recommend

[sqlalchemy] how to change table foreign key target schema?

2008-11-07 Thread sector119
Hi! I have people_table: people_table = sa.Table('people', meta.metadata, sa.Column('id', sa.types.Integer, primary_key=True, autoincrement=False), sa.Column('street_id', sa.types.Integer, sa.ForeignKey('streets.id'), nullable=False), sa.Column('first_name', sa.types.Unicode(255),

[sqlalchemy] Re: how to change table foreign key target schema?

2008-11-07 Thread Michael Bayer
On Nov 7, 2008, at 10:37 AM, sector119 wrote: Hi! I have people_table: people_table = sa.Table('people', meta.metadata, sa.Column('id', sa.types.Integer, primary_key=True, autoincrement=False), sa.Column('street_id', sa.types.Integer, sa.ForeignKey('streets.id'),

[sqlalchemy] Re: how to change table foreign key target schema?

2008-11-07 Thread Michael Bayer
this bug is fixed in 0.5 trunk in r5250. On Nov 7, 2008, at 10:37 AM, sector119 wrote: Hi! I have people_table: people_table = sa.Table('people', meta.metadata, sa.Column('id', sa.types.Integer, primary_key=True, autoincrement=False), sa.Column('street_id', sa.types.Integer,

[sqlalchemy] Re: persistent result set

2008-11-07 Thread Adam Ryan
OK, thank you. But one last thought: Is storing the query rather than the result really the way? I mean, after a couple dozen complex, expensive change operations, the user could end up with only 4 records. It would be more efficient to just store the indexes rather than redo all the queries

[sqlalchemy] Re: persistent result set

2008-11-07 Thread Michael Bayer
On Nov 7, 2008, at 12:18 PM, Adam Ryan wrote: OK, thank you. But one last thought: Is storing the query rather than the result really the way? I mean, after a couple dozen complex, expensive change operations, the user could end up with only 4 records. It would be more efficient to

[sqlalchemy] Memory leak - is session.close() sufficient?

2008-11-07 Thread joelanman
Hi, I'm getting a memory leak with my app - the stack is apache2, mod_wsgi, web.py - and then a lot of sqlalchemy and my own code. The issue may well not be with my usage of SQLA - just making sure there's nothing I might be doing wrong with it. At the start of every web request (__init__ for a

[sqlalchemy] schema inspection api

2008-11-07 Thread Randall Smith
To my knowledge, there doesn't exist a tool to extract schema information from a database with a database independent API. SA does this to some extent by providing table_names and reflectable methods on it's Engine class, but I think it would be nice to have something more comprehensive and

[sqlalchemy] SQLAlchemy 0.5.0rc3 Released

2008-11-07 Thread Michael Bayer
Hey list - The 0.5 series is taking its time getting to the final 0.5.0, but its all good as we are honing and refining this thing to perfection. I've already had rc2 on some near-production systems with no issue and its already widely used. This release is still on rc status since we

[sqlalchemy] Re: schema inspection api

2008-11-07 Thread Randall Smith
If anyone wants to toy with this, I posted it here for the meantime. Works with Postgresql and MSSQL for schema_names, table_names, constraints (including foreign keys) and columns. http://www.tnr.cc/dbinfo.py --Randall --~--~-~--~~~---~--~~ You received this

[sqlalchemy] select where field=max(field)

2008-11-07 Thread John Hunter
I am having trouble writing a sqlalchemy query which selects all rows where a field equals the max for that field, eg q = session.query(Snapshot).filter(Snapshot.totalqty==func.max(Snapshot.totalqty)) When I try and get the results of the query, I get the error below. How should I use

[sqlalchemy] Re: persistent result set

2008-11-07 Thread az
On Friday 07 November 2008 19:18:35 Adam Ryan wrote: OK, thank you. But one last thought: Is storing the query rather than the result really the way? I mean, after a couple dozen complex, expensive change operations, the user could end up with only 4 records. It would be more efficient

[sqlalchemy] Re: select where field=max(field)

2008-11-07 Thread Michael Bayer
Theres a good tutorial on the topic of GROUP BY from a SQL perspective, here: http://weblogs.sqlteam.com/jeffs/jeffs/archive/2007/07/20/60261.aspx in this case you probably want query.filter(Snapshot.totalqty==func.max(Snapshot.totalqty).select()). On Nov 7, 2008, at 3:22 PM, John Hunter

[sqlalchemy] Re: schema inspection api

2008-11-07 Thread Michael Bayer
On Nov 7, 2008, at 1:46 PM, Randall Smith wrote: To my knowledge, there doesn't exist a tool to extract schema information from a database with a database independent API. SA does this to some extent by providing table_names and reflectable methods on it's Engine class, but I think it

[sqlalchemy] Re: schema inspection api

2008-11-07 Thread az
If anyone wants to toy with this, I posted it here for the meantime. Works with Postgresql and MSSQL for schema_names, table_names, constraints (including foreign keys) and columns. http://www.tnr.cc/dbinfo.py eh, when all these attempts will be combined... here's mine: use as u can

[sqlalchemy] Re: select where field=max(field)

2008-11-07 Thread Bobby Impollonia
If you are okay with only getting one record in the case of ties you can do session.query(Snapshot).order_by(Snapshot.totalqty.desc()).first() On Fri, Nov 7, 2008 at 12:22 PM, John Hunter [EMAIL PROTECTED] wrote: I am having trouble writing a sqlalchemy query which selects all rows where a

[sqlalchemy] Re: schema inspection api

2008-11-07 Thread Randall Smith
Michael Bayer wrote: We did long ago attempt to build an information schema API, which was based on the information schema specification, before realizing that this model hardly works in any current RDBMS (for example, its excruciatingly slow on postgres) and is entirely inconsistent

[sqlalchemy] Re: select where field=max(field)

2008-11-07 Thread John Hunter
On Fri, Nov 7, 2008 at 3:57 PM, Michael Bayer [EMAIL PROTECTED] wrote: Theres a good tutorial on the topic of GROUP BY from a SQL perspective, here: http://weblogs.sqlteam.com/jeffs/jeffs/archive/2007/07/20/60261.aspx in this case you probably want

[sqlalchemy] Re: SQLAlchemy 0.5.0rc3 Released

2008-11-07 Thread Eric Ongerth
Mike. You have absolutely perfect spelling. Better than 99% of the population. But there is just this one, and only one, English word that you spell strangely. You consistently spell propagate as propigate. Is there any way we can get an i/a switch in there? p.s. - Major props on being