I’m trying to upload a dataframe to snowflake using sqlalchemy.
Let’s say the dataframe has columns: ‘AA’,’Ba’,’bb’.
For some reason when I use to_sql function it interpets ‘bb’ as case insensitive and doesn’t put “” marks around it, which causes it to resolve to BB.
final_df.to_sql(table_name, connection, if_exists='append', index=False,
chunksize=1000)
I get this error: (snowflake.connector.errors.ProgrammingError) 000904 (42000): SQL compilation error: error line 1 at position 183
invalid identifier ‘BB’
`SQL: INSERT INTO "table" (
"AA",
"Ba",
bb
) VALUES (
%(AA)s,
%(Ba)s,
%(bb)s,
)
params = {
'AA': '',
'Ba': '',
'bb': 'GL-GL1',
}`
I tried to use alter session set quoted_identifiers_ignore_case = True;
, but even though the code runs without an error the data doesnt get uploaded.
I tried to upload a dataframe with one column being all lowercase and it failed.