<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic error on connecting to Snowflake in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15992#M10222</link>
    <description>&lt;P&gt;Hi team, &lt;/P&gt;&lt;P&gt;I'm getting weird error in one of my jobs when connecting to Snowflake. All my other jobs (I've got plenty) work fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current one also works fine when I have only one coding step (except installing needed libraries in my very first step). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error appears when I have more steps in the same job: &lt;/P&gt;&lt;P&gt;1) install needed libraries (this works fine in both cases)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;pip install numpy xgboost&amp;gt;=1.3.2 category-encoders feature-engine==0.6.1 snowflake.sqlalchemy eventlet pyarrow==0.17.0 asn1crypto==1.4.0 auditwheel==3.1.1 azure-common==1.1.25 azure-core==1.8.2 azure-storage-blob==12.5.0 boto3==1.15.18 botocore==1.18.18 certifi==2020.4.5.1 cffi==1.14.3 chardet==3.0.4 cryptography==2.9.2 idna==2.10 isodate==0.6.0 jmespath==0.10.0 msrest==0.6.19 oauthlib==3.1.0 oscrypto pycparser==2.20 pycryptodomex==3.9.8 pyelftools==0.26 PyJWT==1.7.1 pyOpenSSL==19.1.0 python-dateutil==2.8.1 pytz==2020.1 requests==2.23.0 requests-oauthlib==1.3.0 s3transfer==0.3.3 six==1.15.0 urllib3==1.25.11 snowflake-connector-python==2.3.10&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;      (my guess is that I can install those libraries once in configuration so that I don't waste time on each job run, but this is rather secondary question here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) fetch data from postgres into pandas dataframe&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/env python3
import psycopg2 as pg
import pandas.io.sql as psql
pass1 = dbutils.secrets.get("monolith", "prod_pass")
conn1 = pg.connect("host=host1 dbname=db1 user=user1 password=" + pass1)
query1 = """ select column1, column2 from table1 """
&amp;nbsp;
df1 = psql.read_sql(query1, conn1)
 
print("df1: ")
print(df1)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   (works fine in both cases)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) store pandas dataframe into Snowflake table using python connector&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL
 
engine = create_engine(URL(
    account = 'my_account_name',
    user=dbutils.secrets.get("snowflake", "snowflakeusr"),
    password=dbutils.secrets.get("snowflake", "snowflakepwd"),
    database = 'database1',
    schema = 'schema1',
    warehouse = 'warehouse1',
    role='role1',
    login_timeout=120,
    network_timeout=120
))
 
df1.to_sql('tmp_df1', con=engine, index=False, if_exists='replace')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   (also works fine in both cases)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) loop through snowflake table - this step fails if I have (2) and (3) in the same job, but works fine if (2) and (3) steps are absent&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import requests
import eventlet
import time
import snowflake.connector
import json
time.sleep(2)
eventlet.monkey_patch()
&amp;nbsp;
try:
  ctx = snowflake.connector.connect(
      user=dbutils.secrets.get("snowflake", "snowflakeusr"),
      password=dbutils.secrets.get("snowflake", "snowflakepwd"),
      account="account1",
      warehouse="warehouse1",
      database="database1",
      schema="schema1",
      role="role1",
      login_timeout=120,
      network_timeout=120
      )
  cs = ctx.cursor()
  ...
except Exception as error: 
    raise Exception("Error fetching data from Snowflake: " + str(error))
finally:
    cs.close()
    ctx.close()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it fails on line 10 with error: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    487             try:
--&amp;gt; 488                 cnx.do_handshake()
    489             except OpenSSL.SSL.WantReadError:
...
---&amp;gt; 98     poll_obj = select.poll()
AttributeError: module 'select' has no attribute 'poll'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately I can't post full error stack because your forum complains that my post is too long. &lt;/P&gt;&lt;P&gt;Please see full details in pastebin: &lt;/P&gt;&lt;P&gt;&lt;A href="https://pastebin.com/VKwZ1ek4" target="test_blank"&gt;https://pastebin.com/VKwZ1ek4&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround, I just run those in two separate jobs: &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;(1), (2), (3) steps&lt;/LI&gt;&lt;LI&gt;(1), (4) steps&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;But I hope that I can combine those with your help.&lt;/P&gt;&lt;P&gt;Please advise. &lt;/P&gt;</description>
    <pubDate>Sat, 04 Sep 2021 07:46:37 GMT</pubDate>
    <dc:creator>marchello</dc:creator>
    <dc:date>2021-09-04T07:46:37Z</dc:date>
    <item>
      <title>error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15992#M10222</link>
      <description>&lt;P&gt;Hi team, &lt;/P&gt;&lt;P&gt;I'm getting weird error in one of my jobs when connecting to Snowflake. All my other jobs (I've got plenty) work fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The current one also works fine when I have only one coding step (except installing needed libraries in my very first step). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error appears when I have more steps in the same job: &lt;/P&gt;&lt;P&gt;1) install needed libraries (this works fine in both cases)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;pip install numpy xgboost&amp;gt;=1.3.2 category-encoders feature-engine==0.6.1 snowflake.sqlalchemy eventlet pyarrow==0.17.0 asn1crypto==1.4.0 auditwheel==3.1.1 azure-common==1.1.25 azure-core==1.8.2 azure-storage-blob==12.5.0 boto3==1.15.18 botocore==1.18.18 certifi==2020.4.5.1 cffi==1.14.3 chardet==3.0.4 cryptography==2.9.2 idna==2.10 isodate==0.6.0 jmespath==0.10.0 msrest==0.6.19 oauthlib==3.1.0 oscrypto pycparser==2.20 pycryptodomex==3.9.8 pyelftools==0.26 PyJWT==1.7.1 pyOpenSSL==19.1.0 python-dateutil==2.8.1 pytz==2020.1 requests==2.23.0 requests-oauthlib==1.3.0 s3transfer==0.3.3 six==1.15.0 urllib3==1.25.11 snowflake-connector-python==2.3.10&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;      (my guess is that I can install those libraries once in configuration so that I don't waste time on each job run, but this is rather secondary question here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) fetch data from postgres into pandas dataframe&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/env python3
import psycopg2 as pg
import pandas.io.sql as psql
pass1 = dbutils.secrets.get("monolith", "prod_pass")
conn1 = pg.connect("host=host1 dbname=db1 user=user1 password=" + pass1)
query1 = """ select column1, column2 from table1 """
&amp;nbsp;
df1 = psql.read_sql(query1, conn1)
 
print("df1: ")
print(df1)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   (works fine in both cases)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) store pandas dataframe into Snowflake table using python connector&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from sqlalchemy import create_engine
from snowflake.sqlalchemy import URL
 
engine = create_engine(URL(
    account = 'my_account_name',
    user=dbutils.secrets.get("snowflake", "snowflakeusr"),
    password=dbutils.secrets.get("snowflake", "snowflakepwd"),
    database = 'database1',
    schema = 'schema1',
    warehouse = 'warehouse1',
    role='role1',
    login_timeout=120,
    network_timeout=120
))
 
df1.to_sql('tmp_df1', con=engine, index=False, if_exists='replace')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   (also works fine in both cases)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) loop through snowflake table - this step fails if I have (2) and (3) in the same job, but works fine if (2) and (3) steps are absent&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import requests
import eventlet
import time
import snowflake.connector
import json
time.sleep(2)
eventlet.monkey_patch()
&amp;nbsp;
try:
  ctx = snowflake.connector.connect(
      user=dbutils.secrets.get("snowflake", "snowflakeusr"),
      password=dbutils.secrets.get("snowflake", "snowflakepwd"),
      account="account1",
      warehouse="warehouse1",
      database="database1",
      schema="schema1",
      role="role1",
      login_timeout=120,
      network_timeout=120
      )
  cs = ctx.cursor()
  ...
except Exception as error: 
    raise Exception("Error fetching data from Snowflake: " + str(error))
finally:
    cs.close()
    ctx.close()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it fails on line 10 with error: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    487             try:
--&amp;gt; 488                 cnx.do_handshake()
    489             except OpenSSL.SSL.WantReadError:
...
---&amp;gt; 98     poll_obj = select.poll()
AttributeError: module 'select' has no attribute 'poll'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Unfortunately I can't post full error stack because your forum complains that my post is too long. &lt;/P&gt;&lt;P&gt;Please see full details in pastebin: &lt;/P&gt;&lt;P&gt;&lt;A href="https://pastebin.com/VKwZ1ek4" target="test_blank"&gt;https://pastebin.com/VKwZ1ek4&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround, I just run those in two separate jobs: &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;(1), (2), (3) steps&lt;/LI&gt;&lt;LI&gt;(1), (4) steps&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;But I hope that I can combine those with your help.&lt;/P&gt;&lt;P&gt;Please advise. &lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 07:46:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15992#M10222</guid>
      <dc:creator>marchello</dc:creator>
      <dc:date>2021-09-04T07:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15994#M10224</link>
      <description>&lt;P&gt;Looking at the stack trace, this actually seems like an issue with Snowflake's connector. Or maybe there's a namespace conflict with 'select'? You should see if a different version of the snowflake connector works or contact Snowflake.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 20:22:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15994#M10224</guid>
      <dc:creator>Dan_Z</dc:creator>
      <dc:date>2021-09-09T20:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15995#M10225</link>
      <description>&lt;P&gt;Will try &lt;A href="https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v" alt="https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v" target="_blank"&gt;v&lt;/A&gt;2.5.1 and will update.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 21:18:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15995#M10225</guid>
      <dc:creator>marchello</dc:creator>
      <dc:date>2021-09-09T21:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15996#M10226</link>
      <description>&lt;P&gt;@marchello​&amp;nbsp;- How did it go?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 23:10:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15996#M10226</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-13T23:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15997#M10227</link>
      <description>&lt;P&gt;Hi @Piper Wilson​, thanks for asking.&lt;/P&gt;&lt;P&gt;Upgraded Snowflake connector to &lt;A href="https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v" alt="https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/v" target="_blank"&gt;v&lt;/A&gt;2.5.1 in both of my jobs, but didn't try to combine them yet actually. This is TBD. The process is still in DEV state, so it's even more convenient to schedule them separately as I can set one of parts to run more often. Eventually I will need to combine them, but it's not urgent yet.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 23:40:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15997#M10227</guid>
      <dc:creator>marchello</dc:creator>
      <dc:date>2021-09-13T23:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15998#M10228</link>
      <description>&lt;P&gt;@marchello​&amp;nbsp; Cool! &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 14 Sep 2021 12:41:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15998#M10228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-14T12:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15999#M10229</link>
      <description>&lt;P&gt;Just tried to combine my jobs with the latest Snowflake connector version. No, it didn't work. Any other suggestions, please?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 09:16:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/15999#M10229</guid>
      <dc:creator>marchello</dc:creator>
      <dc:date>2021-09-15T09:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/16000#M10230</link>
      <description>&lt;P&gt;@marchello​&amp;nbsp;- I'm passing this on to the team. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 17:28:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/16000#M10230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-15T17:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: error on connecting to Snowflake</title>
      <link>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/16001#M10231</link>
      <description>&lt;P&gt;@marchello​&amp;nbsp;I suggest you contact Snowflake to move forward on this one.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 21:18:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-on-connecting-to-snowflake/m-p/16001#M10231</guid>
      <dc:creator>Dan_Z</dc:creator>
      <dc:date>2021-10-11T21:18:01Z</dc:date>
    </item>
  </channel>
</rss>

