hi all, Sqlalchemy fails to find primary keys in certain situations (if my test/comprehension is correct... ;-). It seems that it fails when looking for a table that has been built by another user. Create 2 identical tables as follows and make them property of 2 different users:
CREATE USER user1; CREATE USER user2; SET SESSION AUTHORIZATION 'user1'; DROP TABLE table1; CREATE TABLE table1 ( user_key varchar(3) NOT NULL PRIMARY KEY ); GRANT ALL on table1 to PUBLIC; SET SESSION AUTHORIZATION 'user2'; DROP TABLE table2; CREATE TABLE table2 ( user_key varchar(3) NOT NULL PRIMARY KEY ); GRANT ALL on table2 to PUBLIC; now connect as user1 and execute: tables = [ 'table1', 'table2' ] for table_name in tables: table = Table(table_name, engine, autoload=True) print table_name print [c for c in table.columns] print table.primary_key you get something like this: table1 [Column('user_key',<sqlalchemy.databases.postgres.PGString object at 0xb6cabf2c>,key='user_key',primary_key=True,nullable=False,hidden=False,default=None)] [Column('user_key',<sqlalchemy.databases.postgres.PGString object at 0xb6cabf2c>,key='user_key',primary_key=True,nullable=False,hidden=False,default=None)] table2 [Column('user_key',<sqlalchemy.databases.postgres.PGString object at 0xb6cb086c>,key='user_key',primary_key=False,nullable=False,hidden=False,default=None)] [] Where primary_key is True for the first and False for the second. Why that? is this a bug or I'm missing something? TIA sandro *:-) -- Sandro Dentella *:-) e-mail: [EMAIL PROTECTED] http://www.tksql.org TkSQL Home page - My GPL work ------------------------------------------------------- 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 searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users