Re: [sqlalchemy] postgres timestamp at time zone

2012-11-19 Thread Michael Bayer
is this psycopg2 ? If you use Python datetime objects with the tz attribute set, it should just work, psycopg2 should do that conversion for you (haven't checked, but typically they are pretty good in this area). Otherwise there are some SQLAlchemy routes to this, including the @compiles

Re: [sqlalchemy] Alembic Hack

2012-11-19 Thread Michael Bayer
On Nov 19, 2012, at 6:21 AM, limodou wrote: I hacked alembic recently, but I have no bitbucket account, and I think my hacks maybe not very good, so I fork the alembic repo in github(someone create it, but the version is not the lastest), so I upgrade my fork to 0.4.0 first, then push my

Re: [sqlalchemy] postgres timestamp at time zone

2012-11-19 Thread espresso maker
Yes, It's psycopg2. I wasn't aware that it does the conversion itself until after I posted my question. I ended up doing what you said. :) Thanks! On Monday, November 19, 2012 7:27:01 AM UTC-8, Michael Bayer wrote: is this psycopg2 ? If you use Python datetime objects with the tz

[sqlalchemy] Trying to apply result of raw sql to an 'in_' clause of mapped table

2012-11-19 Thread Ralph Heinkel
Hi everybody, I've banging my head against this for hours ... maybe someone can help? For a mapped class called 'Person' I'm trying to do something like: query(Person).filter(Person.status_id.in_('select status_id from myschema.mytable where statusname=:n1', n1='hired')) Obviously this does

[sqlalchemy] Audit Table / History Table

2012-11-19 Thread LPG
I'm looking for details on implementing an audit table, either through sqla itself or in a way that plays nicely with sqla. It looks like there used to be an implementation of something like that at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/LogVersions, does anyone know where that code

Re: [sqlalchemy] Audit Table / History Table

2012-11-19 Thread Robert Forkel
http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html#versioned-objects looks like what you may want. On Mon, Nov 19, 2012 at 9:10 PM, LPG lenno...@gmail.com wrote: I'm looking for details on implementing an audit table, either through sqla itself or in a way that plays nicely with sqla. It

Re: [sqlalchemy] Audit Table / History Table

2012-11-19 Thread LPG
Ahah excellent, thanks! Googling sqlalchemy history table / sqlalchemy audit table and searching the docs but those matches don't show up :P Glad to have one way of doing it ... I don't think this uses triggers and I wonder if this can be optimized much by making use of triggers. If I happen

[sqlalchemy] How to use collate/charset key words in sqlalchemy?

2012-11-19 Thread junepeach
If I should have a table 'mytable' defined like below in mysql database: CREATE TABLE mytable ( id int(11) NOT NULL AUTO_INCREMENT, fullname varchar(50)collate utf8_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; How can I add the 'collate' clause and CHARSET

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-19 Thread Thierry Florac
Le Mon, 19 Nov 2012 10:23:14 -0500, Michael Bayer mike...@zzzcomputing.com a écrit: On Nov 19, 2012, at 8:10 AM, Thierry Florac wrote: Hi, I'm using SQLALchemy (currently 0.7.3 in this project, also tested with 0.7.9) with cx_Oracle-5.1.1 in a Zope3 project. SQLAlchemy

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-19 Thread Michael Bayer
On Nov 19, 2012, at 6:23 PM, Thierry Florac wrote: As far as I can understand it, I'm globally OK with you but... probably not completely :-\ I agree with the fact that SQLAlchemy is not the only package which takes part into the global transaction, as SA's session is handled by a Zope

Re: [sqlalchemy] How to use collate/charset key words in sqlalchemy?

2012-11-19 Thread Michael Bayer
the table modifiers here are accepted by Table as mysql_name=value, and alembic's create_table accepts these as well. Unfortunately they appear to be extremely under-documented in the SQLAlchemy documentation (see http://docs.sqlalchemy.org/en/rel_0_8/dialects/mysql.html#storage-engines for

Re: [sqlalchemy] Trying to apply result of raw sql to an 'in_' clause of mapped table

2012-11-19 Thread Michael Bayer
On Nov 19, 2012, at 2:44 PM, Ralph Heinkel wrote: Hi everybody, I've banging my head against this for hours ... maybe someone can help? For a mapped class called 'Person' I'm trying to do something like: query(Person).filter(Person.status_id.in_('select status_id from