RE: [sqlalchemy] how to pick up constraint violation errors in Alchemy

2016-01-04 Thread Gombas, Gabor
If you're using psycopg2, then you may want to use the Diagnostics extension - check the documentation of psycopg2. Gabor > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalchemy@googlegroups.com] On Behalf Of Krishnakant > Sent: 03 January 2016 08:16 > To:

RE: [sqlalchemy] How to commit objects with circular FK references?

2015-12-12 Thread Gombas, Gabor
Alternatively, you could make the constraints deferrable, and set them to deferred mode before adding objects with circular dependencies. > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalchemy@googlegroups.com] On Behalf Of Mike Bayer > Sent: 12 December 2015 02:49

RE: [sqlalchemy] Explicitly name the not null constraint for an Oracle primary key

2015-12-04 Thread Gombas, Gabor
Hi, We solved this a long time ago using an extra function, which gets called after SQLAlchemy did its part. The function queries all constraints, and renames the ones which look like NOT NULL constraints having a name starting with SYS_. This method works well in practice, and since we have

RE: [sqlalchemy] Oracle index not used on SQLAlchemy prepared statement

2014-05-13 Thread Gombas, Gabor
Hi, Maybe you’ve run into this: https://groups.google.com/forum/#!topic/sqlalchemy/8Xn31vBfGKU Gabor From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Thierry Florac Sent: 12 May 2014 23:13 To: sqlalchemy Subject: [sqlalchemy] Oracle index not used on

[sqlalchemy] SQLite temporary tables

2013-11-22 Thread Gombas, Gabor
Hi, How should one create SQLite temporary tables using SQLAlchemy? The following does not work: from sqlalchemy import create_engine, Column, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from

RE: [sqlalchemy] SQLite temporary tables

2013-11-22 Thread Gombas, Gabor
On Nov 22, 2013, at 6:24 AM, Gombas, Gabor gabor.gom...@morganstanley.com wrote: Hi, How should one create SQLite temporary tables using SQLAlchemy? The following does not work: from sqlalchemy import create_engine, Column, String from sqlalchemy.ext.declarative import

Re: [sqlalchemy] testing for an association proxy (possible bug and patch included)

2013-08-23 Thread Gombas, Gabor (IT)
On Fri, Aug 23, 2013 at 12:11:39PM -0700, Jonathan Vanasco wrote: i think a simple fix could be something like this ( line 240, sqlalchemy/ext/associationproxy.py ) if self.scalar: -if not getattr(obj, self.target_collection) -return

RE: [sqlalchemy] The cost of defer()

2013-07-19 Thread Gombas, Gabor
() for a in loaded: assert 'y' not in a.__dict__ assert 'z' not in a.__dict__ assert 'x' in a.__dict__ assert 'q' in a.__dict__ assert a.z == z%d % (a.id - 1), a.z On Jul 11, 2013, at 10:23 AM, Gombas, Gabor gabor.gom

[sqlalchemy] The cost of defer()

2013-07-11 Thread Gombas, Gabor
Hi, I wrote a query joining a couple of tables, returning over a hundred thousand rows. Since I only needed to access a couple of the attributes of the returned objects for this specific use case, I thought to use a dozen or so Query.options(defer(...)) calls to avoid loading the unneeded

RE: [sqlalchemy] The cost of defer()

2013-07-11 Thread Gombas, Gabor
. On Jul 11, 2013, at 4:02 AM, Gombas, Gabor gabor.gom...@morganstanley.commailto:gabor.gom...@morganstanley.com wrote: Hi, I wrote a query joining a couple of tables, returning over a hundred thousand rows. Since I only needed to access a couple of the attributes of the returned objects

[sqlalchemy] Single table inheritance and __table_args__

2013-04-09 Thread Gombas, Gabor (IT)
Hi, What is the recommended method of specifying constraints on columns added by a subclass using single-table inheritance? This does not work, I get a KeyError for col_a: class BaseClass(Base) __table__ = base __table_args__ = (Index(base_col),

[sqlalchemy] SQLite rollback() fails

2012-10-03 Thread Gombas, Gabor
Hi, I've run into a rather interesting issue, where calling session.rollback() dies. The error I get with SQLA 0.7 is: class 'sqlalchemy.exc.InvalidRequestError': Can't attach instance Foo at 0x2acf68808710; another instance with key (class 'module.Foo', (342,)) is already present in this

RE: [sqlalchemy] SQLite rollback() fails

2012-10-03 Thread Gombas, Gabor
I've tested the 0.7 0.8 snapshots, and both work fine now. Thanks! From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: 03 October 2012 17:20 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] SQLite rollback() fails On Oct 3, 2012, at