chemy.core (perhaps with something like
`aiopg`), or whether there is a pattern I'm missing?
Thanks,
Devin
--
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.
(where B.a_id = Column(Integer, ForeignKey('amodels.id'))).
Thanks!
Devin
--
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
First, thanks for your very insightful response. I'm trying to reproduce
what you've provided, but I'm getting an `InvalidRequestError` when
querying on `RefClass`:
*InvalidRequestError: SQL expression, column, or mapped entity expected -
got ''*
Indeed, RefClass has no `__mapper__`
):
ref = AClass
class BRefClass(RefClass):
ref = BClass
engine = create_engine('sqlite://', echo=True)
Base.metadata.bind = engine
Base.metadata.create_all()
db = Session(engine)
Thanks!
Devin
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org
I'm going to link the docs for easy reference for any future readers:
http://docs.sqlalchemy.org/en/latest/orm/self_referential.html?highlight=join_depth#configuring-self-referential-eager-loading
I ended up using something link
session.query(Game).options(joinedload(Game.opp))
because I
from sqlalchemy import Column, and_
from sqlalchemy import create_engine, Integer, String, Date, Enum
from sqlalchemy.orm import sessionmaker, relationship, remote, foreign
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import DataError, IntegrityError
Base =