I have a table of survey responces which each correspond to a particular 
student, identified by an integer student_id.  The database which stores 
that student's data, however, has their id in a VARCHAR2 column. The data in 
that column is really just an int, but I can't change the Oracle database.  
I've tried to relate these two tables using:

SurveyResponse.student = relationship("Person",
    primaryjoin="Person.person_id==SurveyResponse.student_id",
    foreign_keys=[SurveyResponse.student_id]
)

But I get this error when I try to retrieve the student attribute from a 
SurveyResponse instance:

ORA-01722: invalid number


I can't use a ForeignKey object, because these two tables are in different 
databases.  That's why I've got the relationship defined so explicitly.

So, is there any way to tell SQLAlchemy to convert the int "foreign key" on 
the SurveyResponse table into a VARCHAR2 to match the primary key on the 
Person table?  Or is there some other way to make this relationship work?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/o5UECbf9O_4J.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to