Skip to content
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,go/adbc/driver/snowflake: returning Snowflake query ID #1143

Open
matquant14 opened this issue Oct 1, 2023 · 2 comments
Open

python,go/adbc/driver/snowflake: returning Snowflake query ID #1143

matquant14 opened this issue Oct 1, 2023 · 2 comments

Comments

@matquant14
Copy link

I'm starting to explore the adbc snowflake driver for python. Is there a way for the adbc cursor to return the Snowflake query id, like the cursor from the snowflake python connector does, after executing a query? Or do I have to run

SELECT LAST_QUERY_ID()
after I execute my SQL query? I'm not seeing anything in the documentation or in the code

@matquant14 matquant14 changed the title Returning Snowflake query id python:Returning Snowflake query id Oct 2, 2023
@lidavidm
Copy link
Member

lidavidm commented Oct 2, 2023

You will have to do that for now.

gosnowflake does support this so if someone wants to contribute support for exposing this, that would be welcome. I think it would be:

  • Add a statement option that when read, gives the last query ID
  • In the Python bindings for the Snowflake driver, subclass the Cursor class and add a utility method to fetch that option explicitly (just as a convenience)

@lidavidm lidavidm changed the title python:Returning Snowflake query id python,go/adbc/driver/snowflake: returning Snowflake query ID Jan 24, 2024
@lidavidm lidavidm self-assigned this Mar 1, 2024
@lidavidm lidavidm added this to the ADBC Libraries 0.11.0 milestone Mar 1, 2024
@lidavidm lidavidm removed their assignment Mar 1, 2024
@lidavidm lidavidm removed this from the ADBC Libraries 0.11.0 milestone Mar 1, 2024
@lidavidm
Copy link
Member

lidavidm commented Mar 1, 2024

Ok, it looks like this isn't quite possible in the API we use. If we want to support this, someone will have to make a request upstream to gosnowflake first.

Roughly: we use QueryArrowStream which returns a snowflakeArrowStreamChunkDownloader. Internally QueryArrowStream gets a execResponseData which has the QueryID, however, it does not copy the value to the result snowflakeArrowStreamChunkDownloader and throws it away. So we have no way of getting the query ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants