Re: [sqlalchemy] complex in clause

2010-05-27 Thread Glauco Uri
Michael Bayer ha scritto: search the docs for tuple_. wonderful! thank you Gla -- Glauco Uri Prometeia SpA Via G. Marconi, 43 - 40122 Bologna Via Gonzaga, 7 - 20123 Milano Via Tirso, 26 - 00198 Roma Italia e-mail : glauco@prometeia.it phone : +39 051 6480911

RE: [sqlalchemy] Use a foreign key mapping to get data from the other table using Python and SQLAlchemy.

2010-05-27 Thread King Simon-NFHD78
Az wrote: [SNIP] The following code maps these classes to respective database tables. # SQLAlchemy database transmutation engine = create_engine('sqlite:///:memory:', echo=False) metadata = MetaData() customers_table = Table('customers', metadata,

[sqlalchemy] mysql vs sqlite for testing

2010-05-27 Thread Chris Withers
Hi All, We currently run unit tests against sqlite in memory but deploy against MySQL. http://stackoverflow.com/questions/2716847/sqlalchemy-sqlite-for-testing-and-postgresql-for-development-how-to-port ...suggests this is a bad idea. I'm inclined to agree, but... ...running our unit tests

[sqlalchemy] Python sqlanydb module (Sybase ASA) as a driver for sqlalchemy?

2010-05-27 Thread abostick
Hi, For those of us locked into commercial databases, how hard is it to add new engine to alchemy? I ask because Sybase has released an DBAPI 2.0 spec native driver for their SQL Anywhere product versions 10 and 11, also referred to as Sybase ASA. If the python driver is solid, do the

Re: [sqlalchemy] Re: Roundin' up the children!

2010-05-27 Thread Michael Bayer
On May 26, 2010, at 8:01 PM, ObjectEvolution wrote: Thanks for the input Michael. I think the polymorphism is messing things up...just a hunch. Your suggestion didn't work but this ended up working: 'children': relation(Category,

Re: [sqlalchemy] mysql vs sqlite for testing

2010-05-27 Thread Michael Bayer
On May 27, 2010, at 10:00 AM, Chris Withers wrote: Hi All, We currently run unit tests against sqlite in memory but deploy against MySQL. http://stackoverflow.com/questions/2716847/sqlalchemy-sqlite-for-testing-and-postgresql-for-development-how-to-port ...suggests this is a bad idea.

Re: [sqlalchemy] Python sqlanydb module (Sybase ASA) as a driver for sqlalchemy?

2010-05-27 Thread Michael Bayer
theres a driver for adaptive server anywhere 9 in SQLA 0.5. in 0.6, we removed this driver since it hasn't been tested for a few years and replaced with one that is tested against Sybase ASE (which is the more important Sybase we'd like to support). So in this case, assuming you want to go

Re: [sqlalchemy] SA-Lockmode-oracle

2010-05-27 Thread Michael Bayer
On May 26, 2010, at 9:16 AM, dhanil anupurath wrote: DatabaseError: (DatabaseError) ORA-00907: missing right parenthesis OK, the syntax error here is fixed in ra84fef18507e . But the bad news is Oracle really can't handle FOR UPDATE with an ORDER BY or with double-nested subqueries in any

[sqlalchemy] Re: Acting on creation of model instances

2010-05-27 Thread Dan Ellis
On May 26, 2:17 pm, Michael Bayer mike...@zzzcomputing.com wrote: its in the identity map after the flush succeeds, which is well before after_commit() is called.   That sounds reasonable, but I have debug output from after_attach, before_flush, after_flush, before_commit and after_commit,

Re: [sqlalchemy] Re: Acting on creation of model instances

2010-05-27 Thread Michael Bayer
On May 27, 2010, at 11:55 AM, Dan Ellis wrote: On May 26, 2:17 pm, Michael Bayer mike...@zzzcomputing.com wrote: its in the identity map after the flush succeeds, which is well before after_commit() is called. That sounds reasonable, but I have debug output from after_attach,

[sqlalchemy] Re: Roundin' up the children!

2010-05-27 Thread ObjectEvolution
Ah, I see now, that makes sense. I did mean a second mapper but when I wrote that I didn't realize I could actually do that. After reading the docs, I know now ;-) Thanks again for your help Michaelgreat stuff you've got here. Cheers, Jon On May 27, 7:51 am, Michael Bayer

[sqlalchemy] For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-27 Thread Kent
The docs state For each begin_nested() call, a corresponding rollback() or commit() must be issued. In PostgreSql, according to my understanding, if there is ever a database exception, a rollback must be issued. This means a main reason to issue a SAVEPOINT is as a hedge against an error. As

Re: [sqlalchemy] For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-27 Thread Michael Bayer
On May 27, 2010, at 5:12 PM, Kent wrote: The docs state For each begin_nested() call, a corresponding rollback() or commit() must be issued. In PostgreSql, according to my understanding, if there is ever a database exception, a rollback must be issued. This means a main reason to issue a

Re: [sqlalchemy] For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-27 Thread Kent Bower
Thank you, as always. I failed to recognize I'm using the TurboGears foundation, which uses zope transaction: Is there a way to still accomplish this? DBSession.begin_nested() sqlalchemy.orm.session.SessionTransaction object at 0xe9d5150 DBSession.commit() Traceback (most recent call

Re: [sqlalchemy] For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-27 Thread Michael Bayer
heh well thats the TG thing.I've never used it before or studied it, but I the impression I usually get when others talk about it is that their model of autocommit is a bit off. On May 27, 2010, at 6:50 PM, Kent Bower wrote: Thank you, as always. I failed to recognize I'm using the

[sqlalchemy] Re: Acting on creation of model instances

2010-05-27 Thread Dan Ellis
Thanks for your help. I'm not exactly sure what happened, so I'll have to carefully look over this area again, but part of it was definitely to do with needing the distinct session. Here's the minimal example I extracted: http://pastie.textmate.org/private/lpgkq7gkaypmgkphknr2w Frustratingly, the