snowflake-connector-python: SNOW-242177: AttributeError: 'NoneType' object has no attribute 'fetch'
Please answer these questions before submitting your issue. Thanks!
- What version of Python are you using (
python --version)?
Python3.8.2
- What operating system and processor architecture are you using (
python -c 'import platform; print(platform.platform())')?
Using python:3.8.2 image from DockerHub
- What are the component versions in the environment (
pip freeze)?
snowflake-connector-python==2.1.1
azure-storage-blob==2.1.0
jinja2==2.11.2
- What did you do?
results = execute_snowflake_query(snowflake_database, None, query, context, verbose)
existing_privileges = []
for cursor in results:
cursor_results = cursor.fetchmany(1000000)
cursor_results_array = list(itertools.chain.from_iterable(cursor_results))
print(cursor_results_array[0])
if cursor_results_array[0] != 'Statement executed successfully.':
existing_privileges.extend(cursor_results_array)
return existing_privileges
- What did you expect to see?
No error
- What did you see instead?
AttributeError: 'NoneType' object has no attribute 'fetch'
- Can you set logging to DEBUG and collect the logs?
Statement executed successfully.
--
| Traceback (most recent call last):
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/json_result.py", line 76, in __next__
| row = next(self._current_chunk_row)
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/chunk_downloader.py", line 270, in __next__
| return next(self._it)
| StopIteration
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
.... (not showing these as they are my code)
| cursor_results = cursor.fetchmany(1000000)
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/cursor.py", line 844, in fetchmany
| row = self.fetchone()
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/cursor.py", line 823, in fetchone
| return next(self._result)
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/json_result.py", line 82, in __next__
| next_chunk = self._chunk_downloader.next_chunk()
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/chunk_downloader.py", line 187, in next_chunk
| raise self._downloader_error
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/chunk_downloader.py", line 125, in _download_chunk
| result_data = self._fetch_chunk(self._chunks[idx].url, headers)
| File "/usr/local/lib/python3.8/site-packages/snowflake/connector/chunk_downloader.py", line 254, in _fetch_chunk
| return self._connection.rest.fetch(
| AttributeError: 'NoneType' object has no attribute 'fetch'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 22 (7 by maintainers)
@gcnuss , Yes, that is the exact root cause that I found when I was troubleshooting. I think issue was resolved from snowflake-connector-python version 2.7.5.
@sfc-gh-jbahk