snowflakedb / snowflake-sqlalchemy

Snowflake SQLAlchemy
https://pypi.python.org/pypi/snowflake-sqlalchemy/
Apache License 2.0
235 stars 152 forks source link

SNOW-343949: Keep getting error about not pointing to active warehouse when it is defined in my engine... #222

Closed sfc-gh-khaynie closed 1 year ago

sfc-gh-khaynie commented 3 years ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using (python --version)? python 3.8.6

  2. What operating system and processor architecture are you using (python -c 'import platform; print(platform.platform())')? macOS-10.16-x86_64-i386-64bit

  3. What are the component versions in the environment (pip list)? appnope 0.1.2 argon2-cffi 20.1.0 asn1crypto 1.4.0 async-generator 1.10 attrs 20.3.0 azure-common 1.1.25 azure-core 1.8.2 azure-storage-blob 12.5.0 backcall 0.2.0 beautifulsoup4 4.9.3 bleach 3.2.1 boto3 1.15.18 botocore 1.18.18 bs4 0.0.1 certifi 2020.6.20 cffi 1.14.3 chardet 3.0.4 cryptography 2.9.2 decorator 4.4.2 defusedxml 0.6.0 dload 0.6 entrypoints 0.3 html5lib 1.1 idna 2.10 ipykernel 5.4.2 ipython 7.19.0 ipython-genutils 0.2.0 isodate 0.6.0 jedi 0.17.2 Jinja2 2.11.2 jmespath 0.10.0 jsonschema 3.2.0 jupyter-client 6.1.7 jupyter-core 4.7.0 jupyterlab-pygments 0.1.2 kaggle 1.5.10 MarkupSafe 1.1.1 mistune 0.8.4 msrest 0.6.19 nbclient 0.5.1 nbconvert 6.0.7 nbformat 5.0.8 nest-asyncio 1.4.3 notebook 6.1.5 numpy 1.19.4 oauthlib 3.1.0 oscrypto 1.2.1 packaging 20.8 pandas 1.1.5 pandocfilters 1.4.3 parso 0.7.1 pexpect 4.8.0 pickleshare 0.7.5 pip 21.0.1 prometheus-client 0.9.0 prompt-toolkit 3.0.8 ptyprocess 0.6.0 pycparser 2.20 pycryptodomex 3.9.8 Pygments 2.7.3 PyJWT 1.7.1 pyodbc 4.0.30 pyOpenSSL 19.1.0 pyparsing 2.4.7 pyrsistent 0.17.3 python-dateutil 2.8.1 python-slugify 4.0.1 pytz 2020.1 PyYAML 5.4.1 pyzmq 20.0.0 requests 2.23.0 requests-oauthlib 1.3.0 s3transfer 0.3.3 Send2Trash 1.5.0 setuptools 49.2.1 six 1.15.0 snowflake-connector-python 2.4.2 snowflake-sqlalchemy 1.2.4 soupsieve 2.1 SQLAlchemy 1.3.20 terminado 0.9.1 testpath 0.4.4 text-unidecode 1.3 tornado 6.1 tqdm 4.56.0 traitlets 5.0.5 urllib3 1.25.11 wcwidth 0.2.5 webencodings 0.5.1

  4. What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. Yesterday, I was running the code below that was working, but I read in the Snowflake docs that I needed to close my connections and dispose my engines so I did the following after running my below.

    connection1.close()
    engine1.dispose()

I'm trying to run the following lines of code again today, but somehow, I keep getting an error stating I don't have an active warehouse.

from snowflake.sqlalchemy import URL
from sqlalchemy import create_engine
engine1 = create_engine(URL(
    account = account_info['sf_account'],
    user = account_info['sf_user'],
    password = account_info['sf_password'],
    database = 'ELO_CLTV',
    schema = 'INFORMATION_SCHEMA',
    warehouse = 'PYTHON_WH',
    role='sysadmin',
))
connection1 = engine1.connect()
df1 = pd.read_sql_query("select * from tables", engine1)

ProgrammingError: 000606 (57P03): No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.

  1. What did you expect to see? I expected to see no error since i've defined what warehouse I want to use in my engine already.

  2. What did you see instead? ProgrammingError: 000606 (57P03): No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.

  3. Can you set logging to DEBUG and collect the logs? I'm not sure what this means

    
    import logging
    import os

for logger_name in ['snowflake.sqlalchemy', 'snowflake.connector', 'botocore']: logger = logging.getLogger(logger_name) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s')) logger.addHandler(ch)

sfc-gh-cshi commented 3 years ago

We are expecting you to collect debug level log files and upload here if you need more supports from the community and snowflake. The log file location is defined in config file. Thanks.

machow commented 3 years ago

In case it's useful--I recently encountered this error. The issue wasn't my warehouse, which was specified in the URI, but I was specifying the wrong role (PUBLIC, in my case). Changing the role resolved the issue.

github-actions[bot] commented 1 year ago

To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of Apr 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response