On Tue, Jan 22, 2019 at 4:49 PM Daniel Lister <[email protected]> wrote: > Not as much of an issue but inserts are also not handled.
the Query object doesn't do INSERTs, INSERTs are controlled by creating an instance of your mapped class with the desired values upon it. I would imagine if tenant_id is required, you simply make that a NOT NULL column in your table (which it would be anyway) then have tenant_id be the first argument positional argument on all __init__() methods. Or use the "init" mapper event which is called alongside __init__(). There are lots of other ways to get at INSERTs too as well as UPDATE/DELETE within the normal ORM flush process (e.g. not bulk update() or delete()) using the mapper or session hooks.. How you organize these depends on the coding patterns you seek to use (e.g. explicit call everywhere, pulling from a thread local registry, etc.) > > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
