I have a pandas DataFrame in python and want this DataFrame directly to be written into a Netezza Database.
I would like to use the pandas.to_sql() method that is described here but it seems like that this method needs one to use SQLAlchemy to connect to the DataBase.
The Problem: SQLAlchemy does not support Netezza.
What I am using at the moment to connect to the database is pyodbc. But this o the other hand is not understood by pandas.to_sql() or am I wrong with this?
My workaround to this is to write the DataFrame into a csv file via pandas.to_csv() and send this to the Netezza Database via pyodbc.
Since I have big data, writing the csv first is a performance issue. I actually do not care if I have to use SQLAlchemy or pyodbc or something different but I cannot change the fact that I have a Netezza Database.
I am aware of deontologician project but as the author states itself "is far from complete, has a lot of bugs". I got the package to work (see my solution below). But if someone nows a better solution, please let me know!
I figured it out. For my solution see accepted answer.
to_sqlworking.pyodbc.drivers()to see what drivers are available to your Python app. Do you see the Netezza driver in that list?pyodbc.InterfaceError. The error gave me the hint to add a data source in the the Windows ODBC Data source administrator tool and use that instead of trying to "manually" type in the server address. Then it gets the driver. I don't know if this is normal behavior, since in pyodbc it was not neccessary to to that. So instead ofengine = create_engine(netezza://usr:pass@address:port/database_name)I useengine = create_engine(netezza://ODBCDataSourceName)It still does not work yet. I will update my question soon.