Re: [sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-05 Thread Mike Bayer
On Tue, Sep 4, 2018 at 11:00 PM, Alex Rothberg wrote: > I tracked down the error on my side. Looks like I have to use the table name > rather than the model name (doh) in the string. That being said, there may > still be a bug in sqla where it tries to read the name off a join (rather > than a

Re: [sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-04 Thread Alex Rothberg
I tracked down the error on my side. Looks like I have to use the table name rather than the model name (doh) in the string. That being said, there may still be a bug in sqla where it tries to read the name off a join (rather than a table). That being said, any reason not to support the lambda

Re: [sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-04 Thread Alex Rothberg
You're right the error I posted is coming from somewhere else. I am trying to get a stripped down example. In the meantime, it looks like when I add the additional fk constraint, model.__mapper__.get_property(property_name) on a different model starts failing. File

Re: [sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-04 Thread Mike Bayer
On Tue, Sep 4, 2018 at 7:54 PM, Alex Rothberg wrote: > Is it possible to set up a `ForeignKeyConstraint` that uses a class not yet > declared? ie is there a way to use either the lambda or string syntax to > forward declare the fk constrains? Neither works for me. Using strings > yields: > >

[sqlalchemy] ForeignKeyConstraint using Forward Declared Model

2018-09-04 Thread Alex Rothberg
Is it possible to set up a `ForeignKeyConstraint` that uses a class not yet declared? ie is there a way to use either the lambda or string syntax to forward declare the fk constrains? Neither works for me. Using strings yields: File "", line 2, in join_condition File