Home > other >  ImportError: cannot import name '_rfc_1738_quote' from 'sqlalchemy.engine.url'
ImportError: cannot import name '_rfc_1738_quote' from 'sqlalchemy.engine.url'

Time:10-18

I am using a python snowflake connector from the following package: snowflake-sqlalchemy

from sqlalchemy import create_engine
engine = create_engine(...)

It used to be working but it's now failing with this weird error.

I tried to switch to older version of the package, but can't get rid of this error.

Here is the fulll stack trace:

  File "/Users/Etienne.Herlaut/Repositories/python/performance-hub-apps/utils/snowflake.py", line 19, in get_snowflake_connection
    engine = create_engine(f'snowflake://{sf_user}:{sf_password}@{sf_account}?warehouse={wh}&role={role}', connect_args={'timeout': 120})
  File "<string>", line 2, in create_engine
    
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 309, in warned
    return fn(*args, **kwargs)
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 522, in create_engine
    entrypoint = u._get_entrypoint()
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 656, in _get_entrypoint
    cls = registry.load(name)
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 341, in load
    return impl.load()
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 207, in load
    module = import_module(match.group('module'))
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
    
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
    
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
    
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
    
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
    
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/snowflake/sqlalchemy/__init__.py", line 63, in <module>
    from .util import _url as URL
  File "/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/snowflake/sqlalchemy/util.py", line 8, in <module>
    from sqlalchemy.engine.url import _rfc_1738_quote
ImportError: cannot import name '_rfc_1738_quote' from 'sqlalchemy.engine.url' (/Users/Etienne.Herlaut/.pyenv/versions/3.8.13/lib/python3.8/site-packages/sqlalchemy/engine/url.py)

CodePudding user response:

Looks like this is a known issue will get resolved in v1.4.3, per the release notes:

https://github.com/snowflakedb/snowflake-sqlalchemy/blob/main/DESCRIPTION.md

  • Related