Re: [sqlalchemy] I am getting Proxy error (and the application went down) while running the Delete/Insert/Update queries using SQL Alchemy database adopter

2016-01-01 Thread Mike Bayer
SQLAlchemy is not a database driver and does not replace pyodbc. If you are using a database like MS SQL Server, pyodbc is still the default driver if you are connecting with a URL like "mssql://".Also, an application can't switch in place from pyodbc to SQLAlchemy, "installing" is not

Re: [sqlalchemy] Populating foreign key columns when a relationship is set

2016-01-01 Thread Mike Bayer
On 01/01/2016 01:56 PM, Yegor Roganov wrote: > Is there an option to make sqlalchemy populate foreign key column(s) > when a relationship is set? > Basically I want the following: > > child.parent = parent > assert child.parent_id == parent.id just call session.flush() and this assertion will

Re: [sqlalchemy] Populating foreign key columns when a relationship is set

2016-01-01 Thread Yegor Roganov
I think that the "set" event is sufficient in most of my use-cases. Thanks! On Friday, January 1, 2016 at 10:11:45 PM UTC+2, Michael Bayer wrote: > > > > On 01/01/2016 01:56 PM, Yegor Roganov wrote: > > Is there an option to make sqlalchemy populate foreign key column(s) > > when a relationship

[sqlalchemy] automap : problem with two relationships on same foreign key

2016-01-01 Thread yoch . melka
Hi all, I use automap with database reflection to import schema with sqlalchemy. In case I have two relationships on same foreign key in some table, only one relationship is created by prepare(), the second one seems overwrited. My table looks like : Table('thermostat', Base.metadata,

[sqlalchemy] Populating foreign key columns when a relationship is set

2016-01-01 Thread Yegor Roganov
Is there an option to make sqlalchemy populate foreign key column(s) when a relationship is set? Basically I want the following: child.parent = parent assert child.parent_id == parent.id Here is a full example you can run: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy

Re: [sqlalchemy] automap : problem with two relationships on same foreign key

2016-01-01 Thread Mike Bayer
you need to use the name generation functions name_for_scalar_relationship() and/or name_for_collection_relationship() to produce different names in each case. The "constraint" parameter passed as we see in

[sqlalchemy] I am getting Proxy error (and the application went down) while running the Delete/Insert/Update queries using SQL Alchemy database adopter

2016-01-01 Thread Bibhas Satpati
One of our application was previously running via pyODBC. But it has several performance issues in high load. So we decided to use SQL Alchemy instead of pyODBC database adopter. But, after installing the product and use it to run some ZSQL methods (which involves DML queries like