Re: [sqlalchemy] Inherited class column override

2015-04-01 Thread Pierre B
Unfortunately I'm inheriting the relational model from an old application. I have dozens of tables using a single junction table for associations. I can not completely redesign my relational model because it needs to be compatible with the old application. At this point, I think my best option

Re: [sqlalchemy] Inherited class column override

2015-04-01 Thread Mike Bayer
On 4/1/15 4:55 AM, Pierre B wrote: Unfortunately I'm inheriting the relational model from an old application. I have dozens of tables using a single junction table for associations. I can not completely redesign my relational model because it needs to be compatible with the old application.

Re: [sqlalchemy] is True vs ==True

2015-04-01 Thread Jonathan Vanasco
On Wednesday, April 1, 2015 at 2:56:31 AM UTC-4, jo wrote: *session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo == '1') #**true* *session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo == '0') #false* I don't think that

[sqlalchemy] Re: Long transactions with SQLite (and of course locks)

2015-04-01 Thread Eric Smith
Thanks for the comment. If I understand you correctly, I'm going in a similar direction in trying to keep transactions short. If there is a write to the database, I want a commit or rollback shortly thereafter (usually on the order of milliseconds rather than anywhere approaching the 5 second

Re: [sqlalchemy] PostgreSQL UNION with ORDER or LIMIT parenthesis patch

2015-04-01 Thread Charles Leifer
Funnily enough I ran into this particular question regarding Peewee ORM and, googling Postgresql UNION parentheses, I found this post. I ran into the same thing where PG likes the parentheses, but SQLite doesn't. I know this is a very old post, but out of curiosity, how did you end up resolving

Re: [sqlalchemy] Inherited class column override

2015-04-01 Thread Mike Bayer
On 4/1/15 10:28 AM, Pierre B wrote: Here's a simple visual of the schema OK, so that's called a polymorphic foreign key. SQLAlchemy doesn't have first class support for this concept because it's relationally incorrect, but there is an example at

Re: [sqlalchemy] Long transactions with SQLite (and of course locks)

2015-04-01 Thread Mike Bayer
On 4/1/15 12:08 PM, Eric Smith wrote: Thanks Michael -- I appreciate how responsive you are to questions. Yes, it would have been more precise to talk about pysqlite's locking model rather than SQLite's. I'm hesitant to increase the lock timeout because I don't think I want any transactions

Re: [sqlalchemy] Query.delete() ignores outerjoin

2015-04-01 Thread Mike Bayer
On 4/1/15 1:21 PM, Simon Beertree wrote: Hi all, I have two classes, Product and Price, that have a many-to-many relation through a secondary table (see attached test file). I'm trying to delete all Prices that are not related to any Product. I would expect the last query in the file to

[sqlalchemy] Re: regression? in SA 1.0.0b3?

2015-04-01 Thread Jonathon Nelson
I spoke too soon. Adding the .close() did not change things. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to

Re: [sqlalchemy] Re: regression? in SA 1.0.0b3?

2015-04-01 Thread Mike Bayer
On 4/1/15 4:47 PM, Jonathon Nelson wrote: I spoke too soon. Adding the .close() did not change things. well adding tests for these is hard since I can't really get the right sequence of events to occur here, but the fix is just to put a list() around the call which I've done, so try out master

Re: [sqlalchemy] Re: regression? in SA 1.0.0b3?

2015-04-01 Thread Jonathon Nelson
On Wednesday, April 1, 2015 at 3:57:28 PM UTC-5, Michael Bayer wrote: On 4/1/15 4:47 PM, Jonathon Nelson wrote: I spoke too soon. Adding the .close() did not change things. well adding tests for these is hard since I can't really get the right sequence of events to occur here,

[sqlalchemy] regression? in SA 1.0.0b3?

2015-04-01 Thread Jonathon Nelson
I've run into an interesting problem. A legacy bit of code basically does this: sess = session_factory() while stuff_to_do: sess.begin() sometimes_add_stuff_to_sess() if some_condition: sess.rollback() continue other_stuff_here() sess.commit() I was getting