Re: [sqlalchemy] avoid setting attribute on init and or.reconstructor

2017-08-05 Thread Mike Bayer
On Fri, Aug 4, 2017 at 6:07 PM, Shane Carey wrote: > I am trying to remove duplicate code in this scenario described here > > http://docs.sqlalchemy.org/en/latest/orm/constructors.html > > class Obj(Base): > def __init__(self, **kwargs): >

[sqlalchemy] Re: How to get a Engine or Connection from Session?

2017-08-05 Thread Jinghui Niu
That's it! Thanks! On Saturday, August 5, 2017 at 3:15:28 PM UTC-7, Jonathan Vanasco wrote: > > > http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.connection > > > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

[sqlalchemy] Re: How to get a Engine or Connection from Session?

2017-08-05 Thread Jonathan Vanasco
http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.connection -- 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] Re: How to get a Engine or Connection from Session?

2017-08-05 Thread Jinghui Niu
But it's not for returning a connection object? On Aug 5, 2017 1:51 PM, "Ruben Di Battista" wrote: > session.bind? > > On Saturday, August 5, 2017 at 2:36:53 PM UTC+2, Jinghui Niu wrote: >> >> Is there a way to get the currently binding Engine or Connection from a >>

Re: Bypass current version check when stamping.

2017-08-05 Thread Mike Bayer
On Aug 5, 2017 9:05 AM, "Philippe Lavoie" wrote: Ah ok, for sure you're thinking about covering more cases than I am. consider if you have multiple, independent branches (eg are not connected down to the root ) and you only want to stamp for one of them. If it

Re: Bypass current version check when stamping.

2017-08-05 Thread Mike Bayer
On Aug 5, 2017 8:40 AM, "Philippe Lavoie" wrote: Let's say you're on branch and you have a migration, you test it out, it works: everything is cool. The version in `public.alembic_version` is your latest migration. Before you merge it you have to switch to a different

Bypass current version check when stamping.

2017-08-05 Thread Philippe Lavoie
Let's say you're on branch and you have a migration, you test it out, it works: everything is cool. The version in `public.alembic_version` is your latest migration. Before you merge it you have to switch to a different branch to work on something else and you also have a migration there. You

[sqlalchemy] How to get a Engine or Connection from Session?

2017-08-05 Thread Jinghui Niu
Is there a way to get the currently binding Engine or Connection from a Session object? The backend database is Sqlite. Thanks. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and