Closed copdips closed 2 months ago
Hello @copdips ,
Thanks for raising the issue, we are checking with team, I am getting identical results for both of them.
`import snowflake.connector
snowflake_config = {
"account": "account",
"user": "xxxx",
"role": "accountadmin",
"password": "xxxxxx,
"warehouse": "WH",
"database": "SAMPLEDATABASE",
"schema": "TEST",
}
with snowflake.connector.connect(**snowflake_config) as con:
main_cursor1 = con.cursor(snowflake.connector.cursor.DictCursor)
print("cursor1 created")
main_cursor2 = con.cursor(snowflake.connector.cursor.DictCursor)
print("cursor2 created")
# Step 1: Execute a query using Snowpark and retrieve the query ID
#query = "SELECT * FROM MYCSVTABLE LIMIT 10"
#main_cursor.execute(query)
# Retrieve the query ID from the cursor object
#query_id = main_cursor.sfqid
query_id='01b67f09-080b-11df-0000-164926dfee9a'
print(f"Query ID: {query_id}")
main_cursor1.get_results_from_sfqid(query_id)
results = main_cursor1.fetchall()
# Print results
for row in results:
print(row)
print("---------------------\n")
main_cursor2.query_result(query_id)
result_data = main_cursor2.fetchall()
# Print the query result
for row in result_data:
print(row)
Output:
Query ID: 01b67f09-080b-11df-0000-164926dfee9a
` {'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 2, 'LAST_NAME': 'AAABBB', 'FIRST_NAME': 'Craig'} {'SEQ': 3, 'LAST_NAME': 'newuser', 'FIRST_NAME': 'zxxzx'} {'SEQ': 4, 'LAST_NAME': 'forthuser', 'FIRST_NAME': 'forthlast'} {'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 2, 'LAST_NAME': 'AAABBB', 'FIRST_NAME': 'Craig'} {'SEQ': 3, 'LAST_NAME': 'newuser', 'FIRST_NAME': 'zxxzx'} {'SEQ': 4, 'LAST_NAME': 'forthuser', 'FIRST_NAME': 'forthlast'} {'SEQ': 1, 'LAST_NAME': 'Maxwell', 'FIRST_NAME': 'AAAAAAA'}
{'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 2, 'LAST_NAME': 'AAABBB', 'FIRST_NAME': 'Craig'} {'SEQ': 3, 'LAST_NAME': 'newuser', 'FIRST_NAME': 'zxxzx'} {'SEQ': 4, 'LAST_NAME': 'forthuser', 'FIRST_NAME': 'forthlast'} {'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 1, 'LAST_NAME': 'AAAAAAA', 'FIRST_NAME': 'Maxwell'} {'SEQ': 2, 'LAST_NAME': 'AAABBB', 'FIRST_NAME': 'Craig'} {'SEQ': 3, 'LAST_NAME': 'newuser', 'FIRST_NAME': 'zxxzx'} {'SEQ': 4, 'LAST_NAME': 'forthuser', 'FIRST_NAME': 'forthlast'} {'SEQ': 1, 'LAST_NAME': 'Maxwell', 'FIRST_NAME': 'AAAAAAA'} `
Regards, Sujan
It is precisely because the results of these two methods are the same that I would like to ask what specific differences there are between them. Why SF provides 2 methods doing the same thing ? If there're some differences, could you please document them ?
Hello @copdips ,
Sure, will work on modifying the documentation.
Regards, Sujan
What is the current behavior?
In the doc, it only talks about
cursor.get_results_from_sfqid(query_id)
What is the desired behavior?
we need a clarification on the difference between
cursor.get_results_from_sfqid(query_id)
andcursor.query_result(query_id)
How would this improve
snowflake-connector-python
?to let people know how to use these functions in different use cases.
References and other background
No response