I tried this out with 0.3.5 /PG 8.1 and it reflects fine (using the  
schema name "test_schema"):

 >>> t = Table("domains", m, schema="test_schema", autoload=True)
 >>> list(t.primary_key)
[Column('id',PGInteger 
(),primary_key=True,nullable=False,default=PassiveDefault 
(<sqlalchemy.sql._TextClause object at 0x120b230>))]

make sure you can get that far with it first.  that you have a  
"rotating" problem suggests some kind of initialization out-of-order- 
ness.

On Mar 8, 2007, at 9:04 AM, Christoph Haas wrote:

>
> Hi, list...
>
> formerly I had declared my models explicitly in models/__init__.py:
>
> ============================
> from sqlalchemy import *
> from sqlalchemy.ext.assignmapper import assign_mapper
>
> powerdns_domains_table = Table(
>     'domains', meta,
>     Column('id', Integer, primary_key=True),    # gets a sequence  
> assigned
>     Column('name', String(255), nullable=False, unique=True),
>     Column('master', String(20), default=null),
>     Column('last_check', Integer),
>     Column('type', String(6), nullable=False),
>     Column('notified_serial', Integer),
>     Column('account', String(40)),
>     schema='powerdns'
> )
> ============================
>
> Since the database is present anyway and I feel no need to create  
> it in
> websetup.py I decided that I want to simplify the code and use  
> autoload:
>
> ============================
> powerdns_domains_table = Table('domains', meta, autoload=True,
>     schema='powerdns')
> ============================
>
> Unfortunately that leads to the following exception:
>
> sqlalchemy.exceptions.ArgumentError: Could not assemble any primary  
> key
> columns for mapped table 'domains'
>
> Funnily that error is rotating, too. Every time I reload a page in my
> browser I get an exception complaining about one of the other tables I
> define.
>
> This is the schema:
>
> ============================
> CREATE TABLE powerdns.domains
> (
>   id serial NOT NULL,
>   name varchar(255) NOT NULL,
>   master varchar(20),
>   last_check int4,
>   "type" varchar(6) NOT NULL,
>   notified_serial int4,
>   account varchar(40),
>   CONSTRAINT domains_pkey PRIMARY KEY (id),
>   CONSTRAINT domains_name_key UNIQUE (name)
> )
> ============================
>
> So there is definitely a primary key.
>
> Any thoughts?
>
>  Christoph
>  (who feels like a marble in a tarpit currently because every  
> change leads
>  to new "interesting" problems)
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to