I am trying to writer my DataFrame to Snowflake using to_sql method.
sf_conn = snowflake.connector.connect(
account=*****,
user=*****,
password=*****,
role=*****,
warehouse=*****,
database=*****
)
sf_cur = sf_conn.cursor()
df = pd.DataFrame([('Mark', 10), ('Luke', 20)], columns=['name', 'balance'])
df.to_sql('TEST3',con=sf_cur, schema='public', index=False)
But no luck yet.
File "/home/karma/.local/lib/python3.6/site-packages/pandas/io/sql.py", line 1584, in execute
cur = self.con.cursor()
AttributeError: 'SnowflakeCursor' object has no attribute 'cursor'
Even tried giving con=sf_conn but get the following error:
pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': not all arguments converted during string formatting
I am able to do the same job using sqlAlchemy create_engine lib, but wanted to use specifically snowflake connection.