I’m trying upload dataframe on to snowflake. The table is getting create but the data is not getting populated.
This is the code I’m using
try:
df = pd.DataFrame([('Mark', 10), ('Luke', 20), ('Mark1', 78), ('Luk2e', 20)], columns=['name', 'balance'])
df.to_sql(
name=table_name.lower(), con=engine, schema=schema_name,
if_exists=if_exists, index=False, index_label=None,
method=pd_writer
)
except Exception:
traceback.format_exc()
Here are the log. Every query is getting rolled back. Not sure what’s happening
user|INFO|2024-08-01 10:37:36,003|cursor.snowflake.connector.cursor query: [select current_database(), current_schema();]
user|INFO|2024-08-01 10:37:36,350|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:36,350|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:36,351|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:36,675|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:36,676|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:36,677|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:37,063|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:37,063|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:37,064|cursor.snowflake.connector.cursor query: [DESC TABLE /* sqlalchemy:_has_object */ "Employee26".employee]
user|INFO|2024-08-01 10:37:37,386|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:37,400|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:37,788|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:37,788|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:37,788|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:38,120|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:38,120|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:38,122|cursor.snowflake.connector.cursor query: [CREATE TABLE "Employee26".employee ( name TEXT, balance BIGINT )]
user|INFO|2024-08-01 10:37:38,470|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:38,473|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:38,806|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:38,807|cursor.snowflake.connector.cursor Number of results in first chunk: 1
user|INFO|2024-08-01 10:37:38,807|cursor.snowflake.connector.cursor query: [ROLLBACK]
user|INFO|2024-08-01 10:37:39,175|cursor.snowflake.connector.cursor query execution done
user|INFO|2024-08-01 10:37:39,175|cursor.snowflake.connector.cursor Number of results in first chunk: 1