I have my own tran() function, as the doc suggests:

engine = sqlalchemy.create_engine(
'mssql+pyodbc://@SHINKEN/supervielle?trusted_connection=yes&driver=ODBC+Driver+13+for+SQL+Server'
, fast_executemany = True)
def tran(sql,engine):
    with engine.begin() as conn:
        conn.execute(sql)

I execute with it custom sql strings, such as one obtained from another 
custom complex sql-string generation function which obtains a new table 
with log + z-transform of columns that have many 0's, therefore there's a 
lot of NULL values going around. In the sql, 0's get turned into null so 
that I can log, and when I then set variables and new columns as log(), 
each column returns the warning:

Warning: Null value is eliminated by an aggregate or other SET operation.

When running the function on 4 columns, everything is fine. When running it 
on 20, tran() executes as if it were fine, *but the last part of the sql is 
never actually executed* and I receive no warning/error whatsoever on the 
Python console. Please note this DOES run on MS SQL SMS, I tried pasting 
the sql and executing there, and I do receive all the warnings, but it 
completes fine. It appears that when running with sqlalchemy, after a 
certain amount of warnings the execution is dropped.

Anyway, I solved the issue by setting the following at the start of the sql:

SET ANSI_WARNINGS OFF

Nevertheless, I suspect there's something not quite working as it should. 
Maybe I'm doing something wrong, or maybe sqlalchemy could be updated to 
deal with this kind of scenario, or maybe there's a setting I should look 
into in MS SQL 2017.

Any insights? 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 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 sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/c80049c9-698d-4976-849a-abc422d15bf0%40googlegroups.com.

Reply via email to