Fetching data with snowflake connector throws EmptyPyArrowIterator error

2024/10/6 4:03:02

I use python snowflake connector in my python script (plotly dash app) and today the app stopped working without me changing the code. I tried a couple of things to find out what might be the issue and I even tried to run the example code from Snowflake documentation and I got the same error:

code:

cur = conn.cursor()
try:cur.execute("SELECT col1, col2 FROM test_table ORDER BY col1")for (col1, col2) in cur:print('{0}, {1}'.format(col1, col2))
finally:cur.close()

error:

Traceback (most recent call last):File "db_connection.py", line 48, in <module>cur.execute("SELECT col1, col2 FROM test_table ORDER BY col1")File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snowflake/connector/cursor.py", line 580, in executeself._init_result_and_meta(data, _use_ijson)File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/snowflake/connector/cursor.py", line 630, in _init_result_and_metaself._result = ArrowResult(data, self, use_dict_result=self._use_dict_result)File "arrow_result.pyx", line 42, in snowflake.connector.arrow_result.ArrowResult.__init__File "arrow_result.pyx", line 156, in snowflake.connector.arrow_result.ArrowResult._reset
NameError: name 'EmptyPyArrowIterator' is not defined

The connection is established, I am capable of creating a table in my database but I cannot seem to query and iterate the data.

I am on macOS Catalina 10.15.1, snowflake-connector-python==2.1.0, Python 3.7.0.

Answer

You have to install pyarrow module via

pip3 install pyarrow

Installation of the snowflake connector does not automatically install it.

https://en.xdnf.cn/q/70407.html

Related Q&A

What does epochs mean in Doc2Vec and train when I have to manually run the iteration?

I am trying to understand the epochs parameter in the Doc2Vec function and epochs parameter in the train function. In the following code snippet, I manually set up a loop of 4000 iterations. Is it requ…

TensorFlow 2.0 How to get trainable variables from tf.keras.layers layers, like Conv2D or Dense

I have been trying to get the trainable variables from my layers and cant figure out a way to make it work. So here is what I have tried:I have tried accessing the kernel and bias attribute of the Dens…

Convert Excel row,column indices to alphanumeric cell reference in python/openpyxl

I want to convert the row and column indices into an Excel alphanumeric cell reference like A1. Im using python and openpyxl, and I suspect theres a utility somewhere in that package that does this, bu…

Flask-admin - how to change formatting of columns - get URLs to display

Question on flask-admin. I setup flask-admin and one of the models i created is pulling urls and url titles from a mysql database. Using flask-admin, how to i get flask-admin to render the urls instea…

Stream audio from pyaudio with Flask to HTML5

I want to stream the audio of my microphone (that is being recorded via pyaudio) via Flask to any client that connects.This is where the audio comes from:def getSound(self):# Current chunk of audio dat…

Adding into Path var while silent installation of Python - possible bug?

I need to passively install Python in my applications package installation so i use the following:python-3.5.4-amd64.exe /passive PrependPath=1according this: 3.1.4. Installing Without UI I use the Pre…

Pandas add new columns based on splitting another column

I have a pandas dataframe like the following:A B US,65,AMAZON 2016 US,65,EBAY 2016My goal is to get to look like this:A B country code com US.65.AMAZON 2016…

Proper way to insert HTML into Flask

I know how to send some plain text from Python with render_template when a URL is visited:@app.route(/success.html") ... return render_template("index.html", text="This text goes in…

How to add a new class to an existing classifier in deep learning?

I trained a deep learning model to classify the given images into three classes. Now I want to add one more class to my model. I tried to check out "Online learning", but it seems to train on…

Count unique elements along an axis of a NumPy array

I have a three-dimensional array likeA=np.array([[[1,1], [1,0]],[[1,2], [1,0]],[[1,0], [0,0]]])Now I would like to obtain an array that has a nonzero value in a given position if only a unique nonzero …