-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python snowflake adbc_ingest "<Table>does not exist or not authorized" #2545
Comments
Looks to me like the issue is that the select query it generates is: But those double quotes should not be there, not sure how this works for anybody? |
The table created is "MY_TEST" if the Snowflake upper case everything default is turned on. ADBC is saving to "my_test" cursor.execute("Create table my_test (SECURITYID NUMBER)") or cursor.execute('Create table "my_test" (SECURITYID NUMBER)') There is an open ticket out there to set "quoted_identifiers" behavior which would wrap identifiers in quotes depending on how it is set. |
Right so it's a capitalization issue, thanks this at least gives me a workaround! it's also an issue with not handling the database and schema right. Assuming I am in database X, and Schema Y, all three of these should work Also if I am in database X but schema Z, these should still work And even if I am in Database Q, this should still work: But right now the only thing that seems to work is if you are in Database X and Schema Y and refer to it as "MY_TABLE" |
The next problem is that this does not seem to work with temp tables, which is probably the most common use case for inserting for a lot of people to work around the maximum size of an in clause restriction. |
All of those should work just fine with ADBC, do you have an example of them not working?
We have an option for this, I think it's just not yet implemented in the snowflake driver yet. I'll double check this, it shouldn't be difficult to add support for the temp flag in adbc_ingest for the snowflake driver. |
Note that |
"X.Y.MY_TABLE" is a single table name I think. These should be equivalent I believe X.Y.MY_TABLE Anything wrapped in double quotes when passed to Snowflake SQL is literal. |
Ah yes. You should use the options: "adbc.ingest.target_catalog" and "adbc.ingest.target_db_schema" alongside the table name to have them get used for ingest |
It's unfortunate that SQL semantics are odd but essentially ADBC tries not to second-guess the input and treats it as literal (i.e. always quoted), if the database applies case folding to unquoted names it's best to always be explicit and work with the case folded name directly instead of expecting intermediate layers to apply it. This is common enough that perhaps we should put together some cookbook examples, though |
What happened?
I have permissions to insert into a table, but it appears i cant used adbc_ingest to append into the table as well, as I get does not exist or not authorised exception. I have the create stage permissions that the documentations say you need.
cursor.execute("Create table my_test (SECURITYID NUMBER)")
table = pa.table({
'SECURITYID': pa.array([1001, 1002, 1003, 1004, 1005], type=pa.int64())
})
//this works
for row in table.to_pylist():
cursor.execute(
"INSERT INTO my_test (SECURITYID) VALUES (?)",
(row['SECURITYID'],)
)
//this does not work
res = cursor.adbc_ingest("my_test", table, mode="append")
time="2025-02-22T01:45:56Z" level=error msg="error: 002003 (42S02): SQL compilation error:\nObject '"my_test2"' does not exist or not authorized." func="gosnowflake.(*snowflakeConn).queryContextInternal" file="connection.go:413"
Stack Trace
No response
How can we reproduce the bug?
time="2025-02-22T01:45:56Z" level=error msg="error: 002003 (42S02): SQL compilation error:\nObject '"my_test2"' does not exist or not authorized." func="gosnowflake.(*snowflakeConn).queryContextInternal" file="connection.go:413"
Environment/Setup
python snowflake driver, ive tried with both 1.3 and 1.4 and same issue
The text was updated successfully, but these errors were encountered: