[sqlalchemy] (newb) approach to localization

2013-09-20 Thread John Nieri
Hello, I've searched on this topic but haven't found anything approaching authoritative. I'm also new to DBs and SQLAlchemy although not new to python. I'd like to know if there is some mechanism in SQLAlchemy for the common case of having translated / localized content for a given column. Wha

Re: [sqlalchemy] Create Table scripts failing randomly - scripts work from sqlite3 driver but not sqlalchemy

2013-09-20 Thread Simon King
On 20 Sep 2013, at 08:15, monosij.for...@gmail.com wrote: > > I am trying to create multiple tables from a set of 'create table' > scripts.The set of scripts are in a list and I am executing as below. > > The scripts create tables, all scripts tested and work through the sqlite3 > driver fine

Re: [sqlalchemy] Mutable column_properties

2013-09-20 Thread Michael Bayer
On Sep 20, 2013, at 10:35 AM, Philip Scott wrote: > > Without actually querying the DB or enumerating the types and their > conversions myself which seems a bit naff; psycopg2.extensions.adapt almost > does it but not quite (e.g. you get "'2013-09-10'::date" when CAST() gives > you "2013-09

Re: [sqlalchemy] Create Table scripts failing randomly - scripts work from sqlite3 driver but not sqlalchemy

2013-09-20 Thread Michael Bayer
On Sep 20, 2013, at 3:15 AM, monosij.for...@gmail.com wrote: > > I am trying to create multiple tables from a set of 'create table' > scripts.The set of scripts are in a list and I am executing as below. > > The scripts create tables, all scripts tested and work through the sqlite3 > driver f

Re: [sqlalchemy] using WITH query AS, cte() with postgresql

2013-09-20 Thread Michael Bayer
On Sep 20, 2013, at 12:33 AM, Nathan Mailg wrote: > On Sep 19, 2013, at 3:07 PM, Michael Bayer wrote: >> >> On Sep 19, 2013, at 2:46 PM, Nathan Mailg wrote: >> >>> c = aliased(City) >>> q2 = s.query(q1).\ >>> join(Appl.city).\ >>> join(c, Appl.city).\ >>> order_by(q1.c.lastnam

Re: [sqlalchemy] load events with polymorphic_on

2013-09-20 Thread Michael Bayer
this is normal, loading for the base class only hits those columns which are defined for that base class - it does not automatically fan out to all columns mapped by all subclasses. to do so, you can specify with_polymorphic: c = s.query(with_polymorphic(PolyBase, [Cake])).filter_by(name='c1').

[sqlalchemy] load events with polymorphic_on

2013-09-20 Thread Philip Scott
Hello again dear list, I have a mapped class is polymorphic with single table inheritance. I have a function wired up to the load() SA event. The dictionary in the InstanceState which is passed to the load event depends on whether I am querying on the base class or a derived one, which I don't _th

Re: [sqlalchemy] Mutable column_properties

2013-09-20 Thread Philip Scott
| Philip - does this help you at all ? I used the ORM to access the connection and table data in the underlying engine. Thank you for your help guys, it was very helpful! HSTORE updating does work nicely; I've ended up using events as Michael suggested, except that I have hooked into the insert/u

[sqlalchemy] Create Table scripts failing randomly - scripts work from sqlite3 driver but not sqlalchemy

2013-09-20 Thread monosij . forums
I am trying to create multiple tables from a set of 'create table' scripts.The set of scripts are in a list and I am executing as below. The scripts create tables, all scripts tested and work through the sqlite3 driver fine - one at a time. However, through the sqlarchemy driver when I try as