-
Notifications
You must be signed in to change notification settings - Fork 167
SNOW-743102: create_engine(f"snowflake://").dialect fails #386
Copy link
Copy link
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
- What version of Python are you using?
Python 3.11.2 (main, Feb 9 2023, 00:38:19) [GCC 10.2.1 20210110]
- What operating system and processor architecture are you using?
Linux-5.15.0-58-generic-x86_64-with-glibc2.31
- What are the component versions in the environment (
pip freeze)?
snowflake-sqlalchemy==1.4.6
SQLAlchemy==1.4.46
- What did you do?
Minimal program to recreate error:
from sqlalchemy import create_engine
create_engine(f"snowflake://").dialectTraceback:
sa_dialect = create_engine(f"snowflake://").dialect
<string>:2: in create_engine
???
/usr/local/lib/python3.11/site-packages/sqlalchemy/util/deprecations.py:375: in warned
return fn(*args, **kwargs)
/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/create.py:564: in create_engine
(cargs, cparams) = dialect.create_connect_args(u)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <snowflake.sqlalchemy.snowdialect.SnowflakeDialect object at 0x7f92d117c3d0>, url = snowflake://
def create_connect_args(self, url):
opts = url.translate_connect_args(username="user")
if "database" in opts:
name_spaces = [unquote_plus(e) for e in opts["database"].split("/")]
if len(name_spaces) == 1:
pass
elif len(name_spaces) == 2:
opts["database"] = name_spaces[0]
opts["schema"] = name_spaces[1]
else:
raise sa_exc.ArgumentError(
f"Invalid name space is specified: {opts['database']}"
)
> if ".snowflakecomputing.com" not in opts["host"] and not opts.get("port"):
E KeyError: 'host'
/usr/local/lib/python3.11/site-packages/snowflake/sqlalchemy/snowdialect.py:209: KeyError
- What did you expect to see?
I expected to get dialect object without need to set a dummy host.
As a workaround I'm passing `f"{dialect}://dummy" in the mean time to create_engine.
Such workaround is not needed for other sqlalchemy dialects (tested against: "redshift", "postgresql", "mysql")
- Can you set logging to DEBUG and collect the logs?
Reactions are currently unavailable