Re: [Sqlalchemy-users] Re: hook for before_update

2006-02-16 Thread Huy Do
Michael Bayer wrote: On Feb 16, 2006, at 9:02 PM, Huy Do wrote: This would be great. Is there a way to have the default function called on an instance method of each object to be updated ? not sure what you mean ? like setter/getters on the object instance ? I'm not sure myself now...

[Sqlalchemy-users] Table() Instantiation Problem

2006-02-16 Thread Ed Suominen
I get the following error message after trying to call > Table( 'foobars', engine, Column('id', Integer, primary_key=True), > Column('foobar', String) ) a second time in a different thread, with a different engine: > File "/usr/lib/python2.4/site-packages/twisted/internet/threads.py", > line 2

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Michael Bayer
OK, what is the table def exactly ? one limitation about psycopg is that sqlalchemy has to be able to pre-execute whatever defaults exist for the primary key columns of the table. if you insert a row into a postgres table, and some of the primary key columns are None, and theres no sequen

Re: [Sqlalchemy-users] Re: hook for before_update

2006-02-16 Thread Michael Bayer
On Feb 16, 2006, at 9:02 PM, Huy Do wrote: This would be great. Is there a way to have the default function called on an instance method of each object to be updated ? not sure what you mean ? like setter/getters on the object instance ? -

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Robert Leftwich
Michael Bayer wrote: since OIDS are deprecated in postgres I didnt try too hard to get them to work again, once I went through the trouble to get them to be not required. why do you want to use them ? As a workaround to the original problem. Robert

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Robert Leftwich
Michael Bayer wrote: but there could be bugs. what behavior have you observed ? When inserting rows in a table that has a multi-column primary key defined and the engine is created with use_oid=False, I get back a message "cant use cursor.lastrowid without OIDs enabled". Robert ---

Re: [Sqlalchemy-users] PG2Time question

2006-02-16 Thread Michael Bayer
no idea, someone did it that way, just switched it On Feb 16, 2006, at 7:52 PM, Huy Do wrote: Hi, Just wondering why PG2Time extends types.Date instead of types.Time Thanks Huy --- This SF.net email is sponsored by: Splunk Inc. Do you

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Michael Bayer
On Feb 16, 2006, at 10:53 PM, Robert Leftwich wrote: Robert Leftwich wrote: 2. By default OID support is turned off in SQLAlchemy, but this has no impact on the create table statements issued by the postgres engine - which means that in a pre-8.1 database the tables are still created wit

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Michael Bayer
On Feb 16, 2006, at 10:32 PM, Robert Leftwich wrote: 3. Inserting entries into a Postgres table in SQLAlchemy *requires* either an OID or a sequence and this sequence *must* be the primary key. This is the case even if only low level SQLAlchemy (i.e. no ORM/data mapping) is being used.

Re: [Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Robert Leftwich
Robert Leftwich wrote: 2. By default OID support is turned off in SQLAlchemy, but this has no impact on the create table statements issued by the postgres engine - which means that in a pre-8.1 database the tables are still created with OID's regardless of the use_oid setting. This also

[Sqlalchemy-users] Postgres and OID

2006-02-16 Thread Robert Leftwich
I'd like clarification on the use of OID's with Postgres and SQLAlchemy. Please set me straight if I'm wrong: 1. OID's are deprecated from pg 8.1 and in fact it is the default to create tables without OID's in that version on. 2. By default OID support is turned off in SQLAlchemy, but this ha

[Sqlalchemy-users] Re: hook for before_update

2006-02-16 Thread Huy Do
I just committed a change for this into SVN (changeset 936), patch version is attached. Thanks. I'll try and use this. this also raises the idea that maybe a flag on schema.DefaultGenerator which allows it to execute unconditionally on every insert and update might be handy, then youd j

[Sqlalchemy-users] PG2Time question

2006-02-16 Thread Huy Do
Hi, Just wondering why PG2Time extends types.Date instead of types.Time Thanks Huy --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searchin

Re: [Sqlalchemy-users] MS-SQL: Forcing a table alias

2006-02-16 Thread Rick Morrision
Thanks Runar, this should come in handy. I'll check back in with you as I work throught this. I presume that since you added the FROM clause massaging to the SQLCompiler class that this problem runs throughout "normal" queries too. Ugg. Rick On 2/16/06, Runar Petursson <[EMAIL PROTECTED]> wr

Re: [Sqlalchemy-users] MS-SQL: Forcing a table alias

2006-02-16 Thread Runar Petursson
Here is my patch for mssql. It works for me on both Unix (using pymssql) and Windows (using ADODBAPI. There are still some things to work out regarding the ADODBAPI transactions/rollback. There are several work-arounds, including the From clause issue and Identity column issues. The other thing

Re: [Sqlalchemy-users] MS-SQL: Forcing a table alias

2006-02-16 Thread Runar Petursson
Hey Rick, I have written some this. It doesn't pass all of the tests yet, but It works pretty well for starters. I'll send in a few minutes to the list. On 2/16/06, Rick Morrision <[EMAIL PROTECTED]> wrote: > Hi everybody: > > I've begun work on a database engine for MS-SQL (if anyone else is

[Sqlalchemy-users] MS-SQL: Forcing a table alias

2006-02-16 Thread Rick Morrision
Hi everybody: I've begun work on a database engine for MS-SQL (if anyone else is working on this, please let me know ASAP). One of the issues I've run into is that attempting to do table reflection generates an internal query for which MSSQL seems to require a table alias. The query, from infor

Re: [Sqlalchemy-users] Array types?

2006-02-16 Thread Michael Bayer
On Feb 16, 2006, at 12:41 PM, Dimi Shahbaz wrote: I could find nothing in the documentation regarding this. My guess is that I could support this by subclassing types.TypeDecorator, and adding pre- and post-processing of query parameters (http:// www.sqlalchemy.org/docs/types.myt#types_cus

[Sqlalchemy-users] Array types?

2006-02-16 Thread Dimi Shahbaz
I am converting an existing schema into the sqlalchemy database description metadata format. Is there a sqlalchemy type for the SQL array type? CREATE TABLE sal_emp ( nametext, pay_by_quarter integer[], scheduletext[][] ); as described here: http://www.post

Re: [Sqlalchemy-users] Reflection errors

2006-02-16 Thread Dimi Shahbaz
On Feb 15, 2006, at 9:13 PM, Michael Bayer wrote: OK, what version of Postgres are you using ? I cut-and-pasted the same tabledefs into a postgres 8.0.4 DB, ran the same program, and it goes all the way through. I added a second loop that prints repr (table) for each, and it produces pret