[sqlalchemy] Creat table with IF NOT EXISTS caulse in MySQL

2017-09-12 Thread sqlalchemy_mysql
Noticed that generated 'create table' is missing 'IF NOT EXISTS' clause so when the code is run in parallel. It throws OperationalError 1050 Table already exists. We call metadata.create_all method, checkfirst is set to True as it is default. is there any workaround or fix for this issue? --

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 2:54 PM, Dirk Biesinger wrote: > nope, same result using raw pyodbc you don't have that problem? pyodbc would be screwing up here if it's in autocommit mode yet connection.rollback() is doing something.please try patching as follows: diff

Re: [sqlalchemy] "after_insert" event alternative?

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 1:42 PM, Colton Allen wrote: > In an attempt to simplify my app's logic, I want to move some mandatory > method calls into a model event. Traditionally, I've used "after_insert" > but it has some quirks in that you need to use the "connection"

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 1:56 PM, Dirk Biesinger wrote: > when executing the engine.connect() with pool_reset_on_return=None set OK there's a do_rollback in there that isn't controlled by this. So let's instead use the event hook that was on the issue to force no

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 1:14 PM, dirk.biesinger wrote: > Mike, > > I'll post two stacks: > the first one is just calling the engine.connect(): yup different error than before. Add pool_reset_on_return=None to your create_engine: e = create_engine(,

[sqlalchemy] "after_insert" event alternative?

2017-09-12 Thread Colton Allen
In an attempt to simplify my app's logic, I want to move some mandatory method calls into a model event. Traditionally, I've used "after_insert" but it has some quirks in that you need to use the "connection" argument to make updates. What I really want is more flexibility. I'll need use of

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread dirk.biesinger
And I just verified: version 1.1.13 is installed, and loaded for sure just checked via sqlalchemy.__version__ Just to be sure. On Tuesday, September 12, 2017 at 10:14:03 AM UTC-7, dirk.biesinger wrote: > > Mike, > > I'll post two stacks: > the first one is just calling the engine.connect(): >

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread dirk.biesinger
Mike, I'll post two stacks: the first one is just calling the engine.connect(): the second one (look for a row of #) is when calling the df.to_sql() function. 2017-09-12 17:08:23,572 INFO sqlalchemy.engine.base.Engine SELECT SERVERPROPERTY('ProductVersion') 2017-09-12 17:08:23,573 INFO

Re: [sqlalchemy] CTE's with Inserts and Delete

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 11:42 AM, Philip Martin wrote: > My goal is to produce a query that would incrementally refresh new data via > a upsert (insert new data or replace if conflict with primary key) and a > delete query to remove any primary keys that no longer

[sqlalchemy] CTE's with Inserts and Delete

2017-09-12 Thread Philip Martin
My goal is to produce a query that would incrementally refresh new data via a upsert (insert new data or replace if conflict with primary key) and a delete query to remove any primary keys that no longer exist. I am using Postgres 9.6 and Sqlalchemy 1.1. For a simple example in SQL I

Re: [sqlalchemy] problems running test suite for dialect

2017-09-12 Thread Gijs Molenaar
Op dinsdag 12 september 2017 15:46:30 UTC+2 schreef Mike Bayer: > > On Tue, Sep 12, 2017 at 6:38 AM, Gijs Molenaar > wrote: > > Hi again! > > > > I switched to the new style test running, but now I seem to be unable to > set > > the requirements file (see below). I

Re: [sqlalchemy] problems running test suite for dialect

2017-09-12 Thread Mike Bayer
On Tue, Sep 12, 2017 at 6:38 AM, Gijs Molenaar wrote: > Hi again! > > I switched to the new style test running, but now I seem to be unable to set > the requirements file (see below). I noticed changing the requirement_cls in > the sqla_testing section in setup.cfg doesn't

Re: [sqlalchemy] pandas to MS SQL DataWarehouse (to_sql)

2017-09-12 Thread Mike Bayer
On Mon, Sep 11, 2017 at 9:00 PM, Dirk Biesinger wrote: > Mike, > > I have upgraded to 1.1.11 (specifically) after posting and have still seen > the same error. I also used the event override you posted in issue #3994. > Since these experiments I have upgraded to 1.1.13

Re: [sqlalchemy] problems running test suite for dialect

2017-09-12 Thread Gijs Molenaar
Ah! I think i solved it, when I just run py.test it works, but python setup.py test doesn't. Can't figure out why, but i will just use the py.test runner. greetings, - Gijs Op dinsdag 12 september 2017 12:38:00 UTC+2 schreef Gijs Molenaar: > > Hi again! > > I switched to the new style test

Re: [sqlalchemy] problems running test suite for dialect

2017-09-12 Thread Gijs Molenaar
Hi again! I switched to the new style test running, but now I seem to be unable to set the requirements file (see below). I noticed changing the requirement_cls in the sqla_testing section in setup.cfg doesn't have any affect. Do you have a suggestion about what I am missing? greetings, -