Re: [sqlalchemy] SELECT ... INTO Contribution

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 10:33 PM Paul Becotte wrote: > > Hi! > > I recently needed to use the select ... into ... construct to build a temp > table in Redshift. I used the recipe > https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/SelectInto here to > get a good idea of how to go about

[sqlalchemy] SELECT ... INTO Contribution

2018-11-06 Thread Paul Becotte
Hi! I recently needed to use the select ... into ... construct to build a temp table in Redshift. I used the recipe https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/SelectInto here to get a good idea of how to go about this, and was wondering if I should contribute the final working

Re: [sqlalchemy] Custom type compilers interplace with with_variant

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 6:11 PM 'Van Klaveren, Brian N.' via sqlalchemy wrote: > > Hi, > > I want to create a custom type for TINYINT and DOUBLE. > > I've defined them as custom types. > > I want to use with_variant for them, so that in sqlite they print out as > TINYINT and DOUBLE. > > But I

[sqlalchemy] Custom type compilers interplace with with_variant

2018-11-06 Thread 'Van Klaveren, Brian N.' via sqlalchemy
Hi, I want to create a custom type for TINYINT and DOUBLE. I've defined them as custom types. I want to use with_variant for them, so that in sqlite they print out as TINYINT and DOUBLE. But I also want them to use the variants defined for other databases, like Oracle and Postgres. The

Re: [sqlalchemy] How to handle unique constraint for multiple columns containing null values using sqlachemy?

2018-11-06 Thread Mike Bayer
I should add, please specify which backend you're using and what DDL sequence you are looking to emit. On Tue, Nov 6, 2018 at 3:21 PM Mike Bayer wrote: > > On Tue, Nov 6, 2018 at 2:54 PM wrote: > > > > Hi, > > > > I find that `UniqueConstraint` from `sqlachemy` and > >

Re: [sqlalchemy] How to handle unique constraint for multiple columns containing null values using sqlachemy?

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 2:54 PM wrote: > > Hi, > > I find that `UniqueConstraint` from `sqlachemy` and > `op.create_unique_constraint` by `alembic`, it cannot handle multiple columns > that contain null values. > > I saw we can solve using SQL commands via some tricky ways like creating >

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
I've updated the documentation and in a few hours it should be up at https://docs.sqlalchemy.org/en/latest/orm/persistence_techniques.html#simple-vertical-partitioning On Tue, Nov 6, 2018 at 3:04 PM wrote: > > Oh, it's perfect for me if I can use bases for bindings. > > Thank you > > Le mardi 6

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
Oh, it's perfect for me if I can use bases for bindings. Thank you Le mardi 6 novembre 2018 21:27:19 UTC+2, Mike Bayer a écrit : > > On Tue, Nov 6, 2018 at 2:20 PM > wrote: > > > > I have many classes, so it's seems a better idea to use something like > that (but I don't know what exactly is

[sqlalchemy] How to handle unique constraint for multiple columns containing null values using sqlachemy?

2018-11-06 Thread lydia
Hi, I find that `UniqueConstraint` from `sqlachemy` and `op.create_unique_constraint` by `alembic`, it cannot handle multiple columns that contain null values. I saw we can solve using SQL commands via some tricky ways like creating unique index and coalesce, do we have some ways using

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 2:20 PM wrote: > > I have many classes, so it's seems a better idea to use something like that > (but I don't know what exactly is this registry, and why it's a WeakRef dict) > : > > binding = {cls: engine for cls in Base._decl_class_registry.values()} see I don't want

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
I have many classes, so it's seems a better idea to use something like that (but I don't know what exactly is this registry, and why it's a WeakRef dict) : binding = {cls: engine for cls in Base._decl_class_registry.values()} If not, maybe I can use the second approach, overloading Session,

Re: [sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread Mike Bayer
On Tue, Nov 6, 2018 at 9:41 AM wrote: > > Hi, > > I'm using a schema with multiple DB, like : > > engine1 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db1)) > engine2 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db2)) > > Then I use automap and reflection to

[sqlalchemy] How to bind all class associated with an engine ?

2018-11-06 Thread yoch . melka
Hi, I'm using a schema with multiple DB, like : engine1 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db1 )) engine2 = create_engine("mysql://localhost/{db}?charset=utf8".format(db=db2 )) Then I use automap and reflection to generate mapping of all classes needed. Sometime, I

Re: alembic vs system=True columns

2018-11-06 Thread Riccardo Magliocchetti
Thanks a lot Mike! On Wednesday, October 31, 2018 at 7:43:51 PM UTC+1, Mike Bayer wrote: > here's the issue: > > > https://bitbucket.org/zzzeek/alembic/issues/515/system-true-not-generated-for-column > >