[sqlalchemy] Do passive deletes apply to many to many relationships?

2014-05-14 Thread Randy Syring
I am trying to get SQLAlchemy to let my database's foreign keys "on delete cascade" do the cleanup on the association table between two objects. I have setup the cascade and passive_delete options on the relationship as seems appropriate from the docs. However, when a related object is loaded i

Re: [sqlalchemy] common table expressions for INSERT, UPDATE, and DELETE

2014-05-14 Thread Michael Bayer
On May 14, 2014, at 6:35 PM, Hunter Blanks wrote: > Hi, > > Although SQLAlchemy supports PostgreSQL's common table expressions (i.e. WITH > statements*) for SELECT, it does not yet seem to support them for INSERT, > UPDATE, or DELETE. > > (1) Can anyone confirm that this is the case? Lest i

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-14 Thread Seth
Ok, thanks so much for your help. On Wednesday, May 14, 2014 2:35:27 PM UTC-7, Michael Bayer wrote: > > > > there are deferred() columns that you can set on a mapper but there’s not > a mechanism right now to set deferred target attributes when the object is > loaded only from a specific relati

[sqlalchemy] common table expressions for INSERT, UPDATE, and DELETE

2014-05-14 Thread Hunter Blanks
Hi, Although SQLAlchemy supports PostgreSQL's common table expressions (i.e. WITH statements*) for SELECT, it does not yet seem to support them for INSERT, UPDATE, or DELETE. (1) Can anyone confirm that this is the case? Lest it help, I've attached test cases for UPDATE and DELETE below. (2)

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-14 Thread Michael Bayer
there are deferred() columns that you can set on a mapper but there's not a mechanism right now to set deferred target attributes when the object is loaded only from a specific relationship without the specific call within the query(). So unless you maybe ran those options into every Query

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-14 Thread Seth
Thanks Mike, But...is there no way to set this behavior directly on the "relationship()"? The whole point there is to be "lazy" ;) Seth On Saturday, May 10, 2014 7:59:33 PM UTC-7, Michael Bayer wrote: > > > session.query(Parent).options(defaultload(“children”).load_only(“cheap_column")) > > o

Re: [sqlalchemy] Concurrent raw sql execution in a multi-threaded application: Connection is busy with results for another hstmt error

2014-05-14 Thread Sylvester Steele
Correct, that is what I did. Except, I do a conn.close() at the end rather than a del. On Tue, May 13, 2014 at 4:10 PM, Michael Bayer wrote: > > On May 13, 2014, at 2:23 PM, Sylvester Steele > wrote: > > > ODBC connection pooling setting did not matter. After the above change, > code is running

Re: [sqlalchemy] Create database with sqlalchemy > 0.8.0 and postgres

2014-05-14 Thread Tony Locke
I've had a look at this and submitted a patch that should make autocommit work for the pg8000 Sqlalchemy dialect in the same way as it does for the psycopg2 dialect https://github.com/zzzeek/sqlalchemy/pull/88. On Friday, 9 May 2014 17:50:43 UTC+1, Tony Locke wrote: > > Hi, the pg8000 driver has

[sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-14 Thread Sayth Renshaw
Hi Looking for some guidance and advice on using xml as an update source for my to be data web project. If I am consistently going to be updating data into the database from XML files what is a good method? Should I be creating a Sax parser as in this example http://iamtgc.com/importing-xml-i