Michael Bayer schrieb:
> "docvert" probably has no foreign keys in your production DB.  That,  
> or there's some obscure issue on production such that PG is not  
> sending the proper information when SQLAlchemy reflects the  
> table.      If no solution can be found then don't use table  
> reflection for that table.


this works now. thanks

robert



> 
> 
> On Feb 19, 2009, at 10:37 AM, robert rottermann wrote:
> 
>> here are my mappings and the tbl definition
>> thanks again
>> robert
>>
>> engine_factory = EngineFactory(DSN) #, echo=True)
>> SCOPED_SESSION_NAME = SESSIONNAME
>> engine = engine_factory()
>>
>> Base = declarative_base(engine)
>> Base.metadata.reflect()
>> tables = Base.metadata.tables
>>
>> class verteilerCL(Base):
>>    #__table__ = tables2["dokstatus"]
>>    __tablename__ = 'verteiler'
>>    __autoload__ = True
>>    __table_args__ = {'autoload_with' : engine}
>>
>> class docvertCL(Base):
>>    #__table__ = tables2["dokstatus"]
>>    __tablename__ = 'docvert'
>>    __autoload__ = True
>>    __table_args__ = {'autoload_with' : engine}
>>
>> class dokumentCL(Base):
>>    __table__ = tables["dokument"]
>>    #_tablename__ = 'dokument'
>>    __autoload__ = True
>>    __table_args__ = {'autoload_with' : engine}
>>    verteiler = relation(
>>        'verteilerCL',
>>        secondary=docvertCL.__table__,
>>        backref="documents",
>>    )
>>
>> -----------------------------------------
>> Column |  Type   |                      Modifiers
>> --------+--------- 
>> +------------------------------------------------------
>> docid  | integer |
>> vertid | integer |
>> id     | integer | not null default  
>> nextval('docvert_id_seq'::regclass)
>> Indexes:
>>    "docvert_pkey" PRIMARY KEY, btree (id)
>> Foreign-key constraints:
>>    "docid_fk" FOREIGN KEY (docid) REFERENCES dokument(docid) ON  
>> UPDATE CASCADE
>> ON DELETE CASCADE
>>    "vertid_fk" FOREIGN KEY (vertid) REFERENCES verteiler(vertid) ON  
>> UPDATE
>> CASCADE ON DELETE CASCADE
>>
>>
>> codasdb=# \d dokument;
>>                                         Table "public.dokument"
>>    Column    |          Type          |                             
>> Modifiers
>> --------------+------------------------ 
>> +------------------------------------------------------------------
>> docid        | integer                | not null default
>> nextval(('dokument_docid_seq'::text)::regclass)
>> docnum       | character varying(16)  |
>> version      | character varying(8)   |
>> titel        | character varying(128) |
>> deskriptoren | character varying(128) |
>> ablage       | character varying(128) |
>> picicon      | character varying(128) |
>> ort          | character varying(128) |
>> datum        | date                   |
>> typid        | integer                |
>> nintern      | smallint               |
>> nextern      | smallint               |
>> status       | smallint               |
>> directory    | character varying(16)  |
>> idxfti_dok   | tsvector               |
>> Indexes:
>>    "dokument_pkey" PRIMARY KEY, btree (docid)
>>    "uni_docnumversion" UNIQUE, btree (docnum, version)
>>    "dokument_titel_index" btree (titel)
>>    "idxfti_dok_index" gist (idxfti_dok)
>> Foreign-key constraints:
>>    "typid_fk" FOREIGN KEY (typid) REFERENCES doctyp(typid) ON UPDATE  
>> CASCADE
>>
>>
>> codasdb=# \d verteiler
>>                                        Table "public.verteiler"
>>  Column   |          Type          |                              
>> Modifiers
>> -----------+------------------------ 
>> +--------------------------------------------------------------------
>> vertid    | integer                | not null default
>> nextval(('verteiler_vertid_seq'::text)::regclass)
>> typ       | character varying(8)   |
>> verteiler | character varying(128) |
>> id        | integer                | not null default
>> nextval('verteiler_id_seq'::regclass)
>> Indexes:
>>    "verteiler_pkey" PRIMARY KEY, btree (vertid)
>>
>>
>>
>>
>>>> Hi there,
>>>> i have two tables that are lined trouh association table.
>>>> now on the developpment box every thing works fine. but on the live
>>>> db it does
>>>> not work.
>>>> insted I get the following error.
>>>>
>>>> Could not determine join condition between parent/child tables on
>>>> relation
>>>> dokumentCL.verteiler.  Specify a 'primaryjoin' expression.  If this
>>>> is a
>>>> many-to-many relation, 'secondaryjoin' is needed as well
>>>>
>>>> we are using postgres and the newest sa from pypi.the software is
>>>> the same on
>>>> both boxes. (python 3.4)
>>>> on both boxes pstgres is V. 8.3.1
>>>>
>>>>
>>>> thanks for your help
>>>> robert
>>>>
>>>
>>
> 
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to