[sqlalchemy] Re: Filtering a primaryjoin

2008-11-06 Thread Joril
On 5 Nov, 18:17, Joril [EMAIL PROTECTED] wrote: I'd like to add a filter to a relation, so that it ignores records of the remote table if they're flagged as logically_deleted (a boolean field of the child table) Solved, children = relation(Child, primaryjoin=and_(id == Child.parent_id,

[sqlalchemy] Re: proposed extension to SessionExtension: after_bulk_operation

2008-11-06 Thread Michael Bayer
On Nov 6, 2008, at 1:12 AM, Martijn Faassen wrote: Hey, Michael Bayer wrote: OK now that I see it, here's some things I think would make it more generally useful: 1. lets split it into after_bulk_update() and after_bulk_delete(), so that we can identify what operation just occured 2.

[sqlalchemy] Wrong SQL-generation

2008-11-06 Thread mraer
I have such queries: OI = aliased(OrderedItem, name=OrderedItem_AD) CH = aliased(TChart, name=Chart_AD) ORD = aliased(Order, name=Order_AD) alreadyDone = session.query(CH.id).\ join((OI, CH.orderedItems)).\ join((ORD, OI.order)).\ join((User, ORD.user)).\

[sqlalchemy] Re: persistent result set

2008-11-06 Thread Michael Bayer
On Nov 6, 2008, at 12:28 AM, Adam Ryan wrote: Thanks a lot for the reply... So to suggest an alternative to this you'd have to describe what additional behavior is needed, such as is it an issue of overly complex filter criterion being inefficient on the server side, or you're trying to

[sqlalchemy] Re: Wrong SQL-generation

2008-11-06 Thread mraer
Thank you! When will be a build with this fix? --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: mssql reflection fk issue

2008-11-06 Thread Michael Bayer
can you post a trac ticket for this please ? thanks. On Nov 6, 2008, at 1:21 AM, Randall Smith wrote: When reflecting a MSSQL table with a foreign key, the referenced table fails to load with the error: sqlalchemy.exc.NoSuchTableError: [referenced_table] For this case, I'm using:

[sqlalchemy] Should create_engine() be called per-process or per-request in threaded wsgi environment?

2008-11-06 Thread Randy Syring
I am developing a WSGI based web framework with sqlalchemy. I am unclear about when create_engine() should be called. I initially thought that engine creation and metadata would be initialized per process and each thread/request would just get a new session. However, I have recently run into

[sqlalchemy] Re: Should create_engine() be called per-process or per-request in threaded wsgi environment?

2008-11-06 Thread John Fries
Yes, I would also like to know what is the appropriate way to use SQLAlchemy with respect to a WSGI server. I've been using Django with SQLAlchemy (not yet supported, but the recipe here http://lethain.com/entry/2008/jul/23/replacing-django-s-orm-with-sqlalchemy/got me moving), and it's not clear

[sqlalchemy] Re: Should create_engine() be called per-process or per-request in threaded wsgi environment?

2008-11-06 Thread Michael Bayer
On Nov 6, 2008, at 1:29 PM, Randy Syring wrote: I am developing a WSGI based web framework with sqlalchemy. I am unclear about when create_engine() should be called. I initially thought that engine creation and metadata would be initialized per process and each thread/request would just

[sqlalchemy] Re: Should create_engine() be called per-process or per-request in threaded wsgi environment?

2008-11-06 Thread Michael Bayer
if you're using create_engine(), you're using a connection pool. The diagram at http://www.sqlalchemy.org/docs/05/dbengine.html illustrates this. On Nov 6, 2008, at 1:35 PM, John Fries wrote: Yes, I would also like to know what is the appropriate way to use SQLAlchemy with respect to a

[sqlalchemy] Re: persistent result set

2008-11-06 Thread az
On Thursday 06 November 2008 07:28:41 Adam Ryan wrote: Thanks a lot for the reply... So to suggest an alternative to this you'd have to describe what additional behavior is needed, such as is it an issue of overly complex filter criterion being inefficient on the server side, or you're

[sqlalchemy] Re: Should create_engine() be called per-process or per-request in threaded wsgi environment?

2008-11-06 Thread Randy Syring
Thank you for taking the time to respond, I really appreciate it! On Nov 6, 2:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: you should definitely create the engine and metadata on a per-process   basis.   When using SQLite, the engine automatically chooses the   SingletonThreadPool

[sqlalchemy] Re: persistent result set

2008-11-06 Thread Michael Bayer
On Nov 6, 2008, at 12:28 AM, Adam Ryan wrote: I can't store the query object in the beaker session because it can't be pickled, right?. So is there a way to dump a string representation of a query object, then recreate it and associate it with a new SQLA Session? Or am I missing the

[sqlalchemy] Re: persistent result set

2008-11-06 Thread Adam Ryan
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 their respective method (and_, or_), and put them back

[sqlalchemy] Re: declarative, autoload and late binding to engine

2008-11-06 Thread Martijn Faassen
Hi there, MikeCo wrote: I have an application that will need to bind to several different databases with the same structure. The databases to be accessed are not known at import time, that will be determined later while the application is running. I want to use declarative and autoload the