AttributeError while querying: Neither 'InstrumentedAttribute' object nor 'Comparator' has an attribute

前端 未结 4 1359
旧巷少年郎
旧巷少年郎 2021-01-31 14:33

The following code:

Base = declarative_base()
engine = create_engine(r\"sqlite:///\" + r\"d:\\foo.db\",
                       listeners=[ForeignKeysListener()])         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 14:52

    I cannot explain technically what happens but you can work around this problem by using:

    ses.query(FooBar).join(Foobar.bar).join(Bar.foo).filter(Foo.name == "blah")
    

提交回复
热议问题