[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless
But I'm supposed that the generation function of autoincrement only works when the field is NULL or there is an integer, so this fails on fields with a string empty. On Jul 7, 8:06 am, Kless [EMAIL PROTECTED] wrote: Yes, I read it. The integer columns with the primary key flag set are not

[sqlalchemy] query.filter and entity_name

2008-07-07 Thread Christophe de VIENNE
Hi, I'm having trouble using entity_name. I have two mappers for the same class, one of them having an entity_name=legacy. If I do a query with the legacy mapper, I cannot figure how to filter on properties. Ex: session.query(MyClass, entity_name='legacy').filter(

[sqlalchemy] problem with SHOW command

2008-07-07 Thread Manlio Perillo
Hi. I'm having strange problems when I execute a SHOW command with PostgreSQL. from sqlalchemy import create_engine, sql, __version__ print __version__ URL = 'postgres://xxx:[EMAIL PROTECTED]/xxx' db = create_engine(URL, echo=True) conn = db.connect() query = sql.text('SHOW CLIENT_ENCODING')

[sqlalchemy] Re: transactions with multiple potential constraint violations

2008-07-07 Thread Simon
Thanks Mike! Your last suggestion was the best (ans easiest) solution, I guess I just needed someone to point that out to me ;-) Since I want the whole transaction to either succeed or fail, there's no need to use SAVEPOINTs. Cheers, Simon On 3 Jul., 19:55, Michael Bayer [EMAIL PROTECTED]

[sqlalchemy] Re: problem with SHOW command

2008-07-07 Thread Glauco
Manlio Perillo ha scritto: Hi. I'm having strange problems when I execute a SHOW command with PostgreSQL. from sqlalchemy import create_engine, sql, __version__ print __version__ URL = 'postgres://xxx:[EMAIL PROTECTED]/xxx' db = create_engine(URL, echo=True) conn = db.connect() query

[sqlalchemy] Re: result as the dict()

2008-07-07 Thread Bobby Impollonia
MyBase = type(MyBase, (Base, MyMixin), {}) Is this any different than just doing class MyBase(Base, MyMixin): pass ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group,

[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Michael Bayer
On Jul 7, 2008, at 3:06 AM, Kless wrote: Yes, I read it. The integer columns with the primary key flag set are not being autoincremented, after of the Column subclass. what database ? Oracle and Firebird require a Sequence to be specified.

[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Michael Bayer
On Jul 7, 2008, at 3:10 AM, Kless wrote: But I'm supposed that the generation function of autoincrement only works when the field is NULL or there is an integer, so this fails on fields with a string empty. im not sure offhand what an empty string would produce since I'd have to check

[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless
Yes, it's SQLite. I use it into the development. On Jul 7, 4:06 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 3:10 AM, Kless wrote: But I'm supposed that the generation function of autoincrement only works when the field is NULL or there is an integer, so this fails on

[sqlalchemy] Re: query.filter and entity_name

2008-07-07 Thread Michael Bayer
It's currently preferred if you didn't use entity_name since it works quite poorly and even worse in 0.5, and we'd like to remove it - it has built-in undefined behavior in that its not determined which set of attribute instrumentation gets applied to the class. This feature is an artifact

[sqlalchemy] Re: problem with SHOW command

2008-07-07 Thread Manlio Perillo
Glauco ha scritto: Manlio Perillo ha scritto: Hi. I'm having strange problems when I execute a SHOW command with PostgreSQL. from sqlalchemy import create_engine, sql, __version__ print __version__ URL = 'postgres://xxx:[EMAIL PROTECTED]/xxx' db = create_engine(URL, echo=True) conn =

[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Michael Bayer
then its probably inserting your blank string into the column. SQLA doesn't want to get too much in the way of the natural features of the database in use. On Jul 7, 2008, at 11:09 AM, Kless wrote: Yes, it's SQLite. I use it into the development. On Jul 7, 4:06 pm, Michael Bayer

[sqlalchemy] Re: query.filter and entity_name

2008-07-07 Thread az
On Monday 07 July 2008 18:10:19 Michael Bayer wrote: It's currently preferred if you didn't use entity_name since it works quite poorly and even worse in 0.5, and we'd like to remove it - it has built-in undefined behavior in that its not determined which set of attribute instrumentation gets

[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless
You have reason. I checked it with MySQL and it works ok. So here I have a lesson learned: use the same RDBMS on developing. Thanks Michael. On Jul 7, 4:50 pm, Michael Bayer [EMAIL PROTECTED] wrote: then its probably inserting your blank string into the column.  SQLA   doesn't want to get too

[sqlalchemy] synonyms question

2008-07-07 Thread Eric Lemoine
Hello To override attribute behavior the 0.5 doc gives this example: class MyAddress(object): def _set_email(self, email): self._email = email def _get_email(self): return self._email email = property(_get_email, _set_email) mapper(MyAddress, addresses_table, properties =

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Michael Bayer
On Jul 7, 2008, at 3:29 PM, Eric Lemoine wrote: Hello To override attribute behavior the 0.5 doc gives this example: class MyAddress(object): def _set_email(self, email): self._email = email def _get_email(self): return self._email email = property(_get_email,

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Eric Lemoine
On Mon, Jul 7, 2008 at 10:24 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 3:29 PM, Eric Lemoine wrote: Hello To override attribute behavior the 0.5 doc gives this example: class MyAddress(object): def _set_email(self, email): self._email = email def

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Michael Bayer
On Jul 7, 2008, at 5:46 PM, Eric Lemoine wrote: without synonym(), just add _email:addresses_table.c.email to your mapper properties dict so that the email name is made available. In that case, on DB read, SA will set _email directly and won't go through _set_email(). Is that correct?

[sqlalchemy] Re: synonyms question

2008-07-07 Thread Eric Lemoine
On Mon, Jul 7, 2008 at 11:51 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 5:46 PM, Eric Lemoine wrote: without synonym(), just add _email:addresses_table.c.email to your mapper properties dict so that the email name is made available. In that case, on DB read, SA will set