pandas- fetch_pandas_all Connector Kills Kernel

Viewed 687

I'm having trouble with the pandas connector for Snowflake.

The last line of this code causes the immediate death of the python kernel. Any suggestions on how to diagnose such a situation?

import pyarrow
import snowflake.connector
import pandas as pd

ctx = snowflake.connector.connect(
    user=********,
    password=********,
    account=********,
    warehouse='compute_wh',
    database='SNOWFLAKE_SAMPLE_DATA',
    schema='WEATHER'
)
query = 'select * from weather_14_total'
cs = ctx.cursor()
cs.execute()
cs.fetch_pandas_all()

Thanks in advance.

2 Answers

I think you are confusing things a bit.

  1. If you want to use pandas, here is the right link to follow. It's the Snowflake documentation.

  2. You can also not use pandas if you want and just do it:

    cs = ctx.cursor()

    try:

     cs.execute("SELECT col1, col2 FROM test_table ORDER BY col1")
     for (col1, col2) in cs:
         print('{0}, {1}'.format(col1, col2))
    

    finally:

     cs.close()
    

    OR:

    cs = ctx.cursor()

    query = "Select * from table"

    try:

     cs.execute(query)
     .....
     .....
    

    finally:

     cs.close()
    

Also, the documentation link is here.

I was facing the same issue, by just follow few step issue solved. Here is solution.Follow these steps:-[enter image description here][issue img] step 1: pip uninstall pyarrow. step 2: pip install pyarrow==6.0.0 then run your program will work fine.

Related