[sqlalchemy] Composite primary key

2007-01-09 Thread exhuma.twn
Hi, I have to load a table from 2 different data-sources witch each having 3 different primary keys. This is because those 2 datasources are already exported from 3 databases from an archaic application. From those 2 datasources I created - after normalising - 3 new tables. The main table

[sqlalchemy] Accessing attributes in many to many relations

2007-01-09 Thread dusty128
Hi, I'd like to know how to implicitly access attributes in many to many relations. Let's assume the following existing tables: person_table=Table('person',metadata, Column('personid',Integer,primary_key=True), Column('name',String(50)) address_table=Table('address',metadata,

[sqlalchemy] Re: Composite primary key

2007-01-09 Thread Jonathan Ellis
Well, you could specify the primaryjoin as described here: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_customjoin but I suspect that your existing mapper will Just Work if you switch to a composite FK, rather than 3 keys on individual columns t_bovines = Table(

[sqlalchemy] Re: Composite primary key

2007-01-09 Thread exhuma.twn
Jonathan Ellis wrote: Well, you could specify the primaryjoin as described here: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_customjoin but I suspect that your existing mapper will Just Work if you switch to a composite FK, rather than 3 keys on individual

[sqlalchemy] Re: [Sqlalchemy-users] named cursor

2007-01-09 Thread Michael Bayer
On Jan 9, 2007, at 5:24 AM, Michele Petrazzo wrote: Because, like what I wrote on the psycopg2 ml (lists.initd.org/ pipermail/psycopg/2007-January/005250.html) without the server side cursor, the memory usage on the client side is proportionally at the number of records returned by the

[sqlalchemy] Oracle autoload problem?

2007-01-09 Thread Sean Davis
I am experimenting with autoloading tables from Oracle (9.2) running on a remote machine. Normal selects using cx_Oracle work just fine. Here is what I get: from sqlalchemy import * eng = create_engine('oracle:// ...') md = BoundMetaData(eng) g2r = Table('gene2refseq',md,autoload=True)

[sqlalchemy] Re: [Sqlalchemy-users] named cursor

2007-01-09 Thread Michele Petrazzo
Michael Bayer wrote: On Jan 9, 2007, at 5:24 AM, Michele Petrazzo wrote: Because, like what I wrote on the psycopg2 ml (lists.initd.org/ pipermail/psycopg/2007-January/005250.html) without the server side cursor, the memory usage on the client side is proportionally at the number of

[sqlalchemy] Re: Oracle autoload problem?

2007-01-09 Thread Michael Bayer
thats really weird, since you can see the SQL + bind params right there and they are all bound. We have made some changes to Oracle reflection recently but the unit tests were passing on my linux box, as well as on the machine of the person who contributed the changes. so i would ask can

[sqlalchemy] Re: [Sqlalchemy-users] named cursor

2007-01-09 Thread Michael Bayer
OK well this is all quite disturbing ! I would want to examine this more closely. but, lets assume this is really how it is, since thats how it looks (eesh). So, you dont really want to use named cursors, you just want psycopg2 to use cursors in its underlying operations so that it has

[sqlalchemy] customize table creation

2007-01-09 Thread Daniel Haus
Hi alchemists! Is there any way to have SA do some custom work before it creates a table? I tried to subclass Table and override create, which obviously doesn't work that easily. Any suggestions or ideas? The background is, I have some objects that dynamically add columns to the table on

[sqlalchemy] Re: customize table creation

2007-01-09 Thread Jonathan Ellis
On 1/9/07, Daniel Haus [EMAIL PROTECTED] wrote: Hi alchemists! Is there any way to have SA do some custom work before it creates a table? I tried to subclass Table and override create, which obviously doesn't work that easily. Any suggestions or ideas? The background is, I have some

[sqlalchemy] MSSQL session.flush() doesn't always fetch primary keys

2007-01-09 Thread Paul Johnston
Hi, Using MSSQL, session.flush() doesn't always fetch primary keys back from the database. It works if you explicity specify a sequence, but if the sequence is implicitly created it doesn't fetch. I have raised ticket #415 for this issue. In MSSQLExecutionContext, it looks to see if any

[sqlalchemy] Re: Oracle autoload problem?

2007-01-09 Thread Sean Davis
On 1/9/07, Andrija Zarić [EMAIL PROTECTED] wrote: This very strange, because SQLAlchemy is issuing the query like it is supposed to do. There is bind variable (table_name) but for some reason cx_Oracle/Oracle is raising ORA-1008. Can you assert that following is working: import cx_Oracle

[sqlalchemy] Re: Accessing attributes in many to many relations

2007-01-09 Thread Hermann Himmelbauer
Am Dienstag, 9. Januar 2007 17:01 schrieb Michael Bayer: we do have an extension called associationproxy that is used for something similar with association objects...it may give you some ideas on how to proxy attributes across. i dont think you should approach the idea of adding individual

[sqlalchemy] Re: MSSQL session.flush() doesn't always fetch primary keys

2007-01-09 Thread Paul Johnston
Hi Rick, I think we're actually agreeing about almost everything, although I have responded to your points individually. Lets see what Michael says about this. Actually reading over my post again, my preferred fix was a little hidden at the bottom. I will highlight it here: The fix that

[sqlalchemy] Re: MSSQL session.flush() doesn't always fetch primary keys

2007-01-09 Thread Michael Bayer
the current behavior of SA is to utilize the databases implicit PK generation feature *if one is available*. the three databases that I know have this are sqlite (send None in to a PK INSERT, it gets generated), MySQL (AUTOINCREMENT) and Postgres (SERIAL/BIGSERIAL, which results in the

[sqlalchemy] Re: Saving all transactions against a database (logging queries?)

2007-01-09 Thread Brian Jarrett
Jose, Try it without the level=, format=, and datefmt= options in logging.basicConfig() (leaving in only filename= and filemode=) and I think it'll work. Then you can try adding in the other options one at a time and see if you can get them to work. When I only had filename and filemode