Closed z27fang closed 3 years ago
Some updates with this issue.
I noticed this usually happens while the result was cached. Today I sent the same query multiple times with same role/account, thought it returned the result, it's still popping the message of Don't know how to construct ResultBatches...
. I will share some details for this error later.
Hi @z27fang
This is actually a bug that was already addressed in #852, but it just happens that after logging this error the code still works properly.
You can safely ignore this until 2.6.1
is released (which will have #852 included), or downgrade to 2.5.1
in the meantime.
Please re-open this ticket if you believe that this was closed incorrectly
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
Python 3.7.11
What operating system and processor architecture are you using?
Platform: Darwin-19.6.0-x86_64-i386-64bit
What are the component versions in the environment (
pip freeze
)?What did you do? In snowflake database I have 1 user with 2 different roles. One as
operator
and the other namedmonitor
.The
operator
role has the right to access through all tables but not credit history, where themonitor
role can access snowflake credit consumption history.The query I ran:
Basically, it selects credit consumption from different dates, do some calculation and find out outliers based on some simple rule.
While using the
monitor
role, the query runs all good. But when using theoperator
role (which does not have access to credit history), the program throws an error:This error happens after I fire
cur.execute(query)
.What did you expect to see?
The expected behaviour might be a warning that the current role doesn't support the query, or throw an informative error instead of telling user that it's unable to construct the result due to some reason. (I am not sure if the above error is expected as it's coded in connector) By doing some digging, I noticed from the return body, it has:
'rowsetBase64': ''
and'queryResultFormat': 'arrow'
. This results https://github.com/snowflakedb/snowflake-connector-python/blob/a3f4cfa407c9f3e9ede234dc6d856b41c8a4037c/src/snowflake/connector/cursor.py#L783_query_result_format
to be set to 'arrow'. And https://github.com/snowflakedb/snowflake-connector-python/blob/a3f4cfa407c9f3e9ede234dc6d856b41c8a4037c/src/snowflake/connector/result_batch.py#L105rowset_b64
to be set to '""' Finally it goes to this error https://github.com/snowflakedb/snowflake-connector-python/blob/a3f4cfa407c9f3e9ede234dc6d856b41c8a4037c/src/snowflake/connector/result_batch.py#L179-L190Can you set logging to DEBUG and collect the logs?
The program terminates at the last line.