[sqlalchemy] Re: Querying an Association Proxy using an enum column in the intermediate table

2019-04-22 Thread Jason Armstrong
Here is an update to the original that now works, implementing Mike's solution of a single table inheritance for the association object. Thank you again! from sqlalchemy import Column, ForeignKey, Enum, Text, Integer, create_engine from sqlalchemy.orm import relationship, backref,

Re: [sqlalchemy] Querying an Association Proxy using an enum column in the intermediate table

2019-04-22 Thread Jason Armstrong
On Mon, 22 Apr 2019 at 20:10, Mike Bayer wrote: > So the architecture here should instead use three relationships, and to make it automatically handle the enumeration you can use a single table inheritance pattern on your association object, meaning you would have ContractorAssociation,

Re: [sqlalchemy] Querying an Association Proxy using an enum column in the intermediate table

2019-04-22 Thread Mike Bayer
I'm on mobile at the moment but currently while your code embeds an appropriate creational pattern into each association proxy, that has no bearing upon the objects that each proxy returns, since they are all proxying the same collection which contains everything. The reason it's called a "proxy"

[sqlalchemy] How to reload data from table/all tables using sqlalchemy ORM?

2019-04-22 Thread Jan Sakalos
Hello, How to reload data from table/all tables using sqlalchemy ORM? Thanks Jano -- 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

Re: [sqlalchemy] Checking approaches around parallel data import for records

2019-04-22 Thread Markus Elfring
> class T2(Base): > __table__ = Table("t2", Base.metadata, autoload_with=session.connection()) > __mapper_args__ = { > "primary_key": [__table__.c.source_file] # a primary key must > be determined > } A variant of this software design approach can work also for my data