I am trying to figure out how to upload/insert csv table files into Aginity Workbench (uses Netezza driver) using Python for both existing and non-existing tables.
My Python code is able to print queries displaying data, but I'm unable to drop or create tables. It does not display any error when I run the create or drop code, however when I go into Aginity, the tables I intended to create do not exist, and the tables I want to drop were not dropped.
import pyodbc
# pyodbc connection string
conn = pyodbc.connect("DRIVER={driver};SERVER=server; PORT=port;DATABASE=database; UID=username;PWD=password;")
# Define Cursor
cus = conn.cursor()
# SQL query
sql = 'drop table username.test'
cus.execute(sql)
I get an output with no errors like the following, but the drop didn't actually happen.
<pyodbc.Cursor at 0x1ac108181b0>
Any tips would be greatly appreciated!
@roganjosh points out I should add conn.commit()