Liu Shengpeng
2017-01-19 02:40:15 UTC
Base = automap_base()
engine = create_engine("sqlite:///xx.sqlite")
Base.prepare(engine, reflect=True)
session = Session(engine)
Item = Base.classes["items"]
for item in session.query(Item).limit(10):
print(item)
error occurs:
InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper|items|items'. Original exception was: Error creating backref 'items_collection' on relationship 'items.items_collection': property of that name exists on mapper 'Mapper|items|items'
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
engine = create_engine("sqlite:///xx.sqlite")
Base.prepare(engine, reflect=True)
session = Session(engine)
Item = Base.classes["items"]
for item in session.query(Item).limit(10):
print(item)
error occurs:
InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper|items|items'. Original exception was: Error creating backref 'items_collection' on relationship 'items.items_collection': property of that name exists on mapper 'Mapper|items|items'
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.