[sqlalchemy] Patterns for building with SQLAlchemy / asyncio

2018-08-09 Thread devin
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.

[sqlalchemy] Nested Exists Query produces join

2018-02-09 Thread devin
(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

Re: [sqlalchemy] DeclaredAttr

2016-11-08 Thread devin
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__`

[sqlalchemy] DeclaredAttr

2016-11-07 Thread devin
): 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

Re: [sqlalchemy] Self referential table, with composite key, and relationship(..., lazy='joined') is not eager loading as expected.

2016-03-13 Thread Devin Jacobs
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

[sqlalchemy] Self referential table, with composite key, and relationship(..., lazy='joined') is not eager loading as expected.

2016-03-12 Thread Devin Jacobs
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 =