I am getting an error while loading a file using Pandas Dataframe's to_sql
method on an Informix Database. I am able to connect to the Informix database and execute the select query using the read_sql_query
method like so:
df = pd.read_sql_query(query,con)
But the code below is throwing an error, and I can't figure out why:
con = pyodbc.connect(constr, autocommit=True)
file ='/home/webload/rajesh.txt'
df = pd.read_csv(file, sep="\t")
pd.DataFrame.to_sql(name='customers', schema='informix', con=con, if_exists='append', index=False )
This is the error I'm receiving:
Traceback (most recent call last):
File "connect1.py", line 42, in <module>
pd.DataFrame.to_sql(name='customers', schema='informix',con=con, if_exists='append', index=False )
TypeError: to_sql() missing 1 required positional argument: 'self'