[sqlalchemy] Re: sqlalchemy migration/schema creation

2008-04-16 Thread az
a separate feature - no. but it's not much to do it. here my attempt at this. try copyall or copydata+autoload from here: http://dbcook.svn.sourceforge.net/viewvc/dbcook/trunk/dbcook/misc/metadata/ svn co http://dbcook.svn.sourceforge.net/dbcook/trunk/dbcook/misc/metadata/ it's not dbcook/

[sqlalchemy] (auto-)flush issue

2008-04-16 Thread Lele Gaifax
Hi, I spent a few hours investigating a strange but very simple problem: by any chance I'm missing something obvious... Elaborating on Paul's proc_hash, I now have a similar behaviour on all my entities. It's not a very important feature, but it surely makes it easier to introduce test data into

[sqlalchemy] Temporary table example?

2008-04-16 Thread Gloria W
Hi again, I am looking for a good example on how to form a temporary table. I have two unrelated tables with no foreign keys. But I want to consolidate the data into a temp table and sort on their date field, to see all records chronologically from both tables. I could do it by hand in Python,

[sqlalchemy] Session binding to existing table: what am I missing?

2008-04-16 Thread Gloria W
Hi all, I am trying to use the session syntax to bind to an existing table, but I am apparently missing something. I want my session to be bound to this: my_table = sqlalchemy.Table('my_table', meta, autoload=True, autoload_with=engine) and if I use the same engine here: session =

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread Michael Bayer
On Apr 15, 2008, at 10:32 PM, Dave Harrison wrote: Hey all, The below code establishes 3 tables (house, dog, owner) and a mapper table to associate owners and dogs (friendships). When I use either MySQL (5.0.51) or SQLite (3.4.2) as the backend, this code works correctly. However when

[sqlalchemy] Re: Get Mapper for Table

2008-04-16 Thread Michael Bayer
On Apr 16, 2008, at 10:13 AM, Koen Bok wrote: Hey all, Before 0.4.5 I used this code to get the mapped class for a table. It worked fine, but mapper_registry was made private in 0.4.5 and the private function does not behave the same way for some reason. But as this code is pretty nasty

[sqlalchemy] Get Mapper for Table

2008-04-16 Thread Koen Bok
Hey all, Before 0.4.5 I used this code to get the mapped class for a table. It worked fine, but mapper_registry was made private in 0.4.5 and the private function does not behave the same way for some reason. But as this code is pretty nasty anyway I was wondering if there was a better way to do

[sqlalchemy] Table constructor ignores quote=False when table name is mixed case

2008-04-16 Thread Dr.T
I am using mixed case for my Elixir Entities in common with other identifiers. When these are passed though to SQLAlchemy, the table name is double- quoted in generated SQL and the database is created with quoted table names. This does not matter with SQLite, which ignores quotes in this

[sqlalchemy] Re: Table constructor ignores quote=False when table name is mixed case

2008-04-16 Thread Michael Bayer
On Apr 16, 2008, at 12:22 PM, Dr.T wrote: Oracle however becomes case sensitive when quotes are used and if a table is created with a quoted name, you must always quote references to it thereafter, which most people would not want! To sort this out, I thought that I could just pass the

[sqlalchemy] Re: Table constructor ignores quote=False when table name is mixed case

2008-04-16 Thread Dr.T
Michael, You are right and that is what I have done. I didn't appreciate that what I suggested would add overhead ;-( Perhaps a line could be added to the Table constructor documentation to point out that the name kwarg is ignored when the table name is in mixed case (because this is not

[sqlalchemy] association_proxy import fail

2008-04-16 Thread Vortexmind
Hi all I'm new to python and was playing around with Elixir tutorial (a wrapper for Sqlalchemy). I get a failed import with this code from elixir import * metadata.bind = sqlite:///movies.sqlite metadata.bind.echo = True class Movie(Entity): title = Field(Unicode(30)) year =

[sqlalchemy] Re: Session binding to existing table: what am I missing?

2008-04-16 Thread jason kirtland
Gloria W wrote: Hi all, I am trying to use the session syntax to bind to an existing table, but I am apparently missing something. I want my session to be bound to this: my_table = sqlalchemy.Table('my_table', meta, autoload=True, autoload_with=engine) and if I use the same engine

[sqlalchemy] Re: association_proxy import fail

2008-04-16 Thread Vortexmind
You're right I've installed the 0.45 and it works :) Thank you! On Apr 16, 7:33 pm, jason kirtland [EMAIL PROTECTED] wrote: The function 'association_proxy' is present starting in 0.3.8+. The 0.3.7 release is few days shy of a year old- the current version is 0.4.5. I'd suggest upgrading

[sqlalchemy] Re: sqlalchemy migration/schema creation

2008-04-16 Thread Lukasz Szybalski
On Wed, Apr 16, 2008 at 1:03 AM, [EMAIL PROTECTED] wrote: a separate feature - no. but it's not much to do it. here my attempt at this. try copyall or copydata+autoload from here: http://dbcook.svn.sourceforge.net/viewvc/dbcook/trunk/dbcook/misc/metadata/ svn co

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread David Harrison
On 17/04/2008, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 15, 2008, at 10:32 PM, Dave Harrison wrote: Hey all, The below code establishes 3 tables (house, dog, owner) and a mapper table to associate owners and dogs (friendships). When I use either MySQL (5.0.51) or

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread Michael Bayer
On Apr 16, 2008, at 6:21 PM, David Harrison wrote: If I use delete, delete-orphan I get the same errors Like I mentioned, delete-orphan doesn't work very well separated from delete cascade - which means that its only appropriate for a one-to-many or one-to-one relation. When many

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread Michael Bayer
On Apr 16, 2008, at 7:59 PM, David Harrison wrote: On 17/04/2008, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 16, 2008, at 6:21 PM, David Harrison wrote: If I use delete, delete-orphan I get the same errors Like I mentioned, delete-orphan doesn't work very well separated from

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread Eric Ongerth
On Apr 16, 7:24 am, Michael Bayer [EMAIL PROTECTED] wrote: always use delete cascade in conjunction with delete-orphan. It doesnt make much sense to have delete-orphan only and not delete cascade. Oh wow. That clears up a few things for me. I don't remember ever seeing this (or at

[sqlalchemy] Re: Postgres cascade error ?

2008-04-16 Thread David Harrison
On 17/04/2008, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 16, 2008, at 9:31 PM, Eric Ongerth wrote: On Apr 16, 7:24 am, Michael Bayer [EMAIL PROTECTED] wrote: always use delete cascade in conjunction with delete-orphan. It doesnt make much sense to have delete-orphan only