Hi,
I'm getting the following error with SQLAlchemy 0.7.3:
sqlalchemy.exc.ArgumentError: Could not determine join condition between
parent/child tables on relationship Survey.bossSpectrumHeaders. Specify a
'primaryjoin' expression. If 'secondary' is present, 'secondaryjoin' is needed
as well.
I am relating two tables named "Survey" and "BOSSSpectrumHeader". The former is
in a schema called "platedb" and the latter in another schema called "boss".
The latter table has numerous foreign keys from the platedb schema, but and
each fail if I comment out the previous one. The search path is "platedb,
shared, boss, photofield, twomass, public". The python code is:
class BOSSSpectrumHeader(Base):
__tablename__ = 'spectrum_header'
__table_args__ = {'autoload' : True, 'schema' : 'boss', 'extend_existing' :
True}
class Survey(Base):
__tablename__ = 'survey'
__table_args__ = {'autoload' : True, 'schema' : 'platedb'}
Survey.bossSpectrumHeaders = relationship(BOSSSpectrumHeader, backref="survey")
Finally, the SQL definitions of the tables are pasted below. Is there something
I am missing? Why is the foreign key not being retrieved via reflection?
Virtually everything else (including cross-schema relationships) is working
fine.
Thanks for any help!
Cheers,
Demitri
---
CREATE TABLE boss.spectrum_header
(
pk integer NOT NULL DEFAULT nextval('spectrum_header_pk_seq'::regclass),
...
survey_pk integer NOT NULL,
CONSTRAINT boss_spectrum_header_pk PRIMARY KEY (pk ),
CONSTRAINT survey_fk FOREIGN KEY (survey_pk)
REFERENCES survey (pk) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE RESTRICT
)
CREATE TABLE survey
(
pk serial NOT NULL,
label text,
CONSTRAINT survey_pk PRIMARY KEY (pk ),
CONSTRAINT survey_label_uniq UNIQUE (label )
)
--
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.