diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-22 13:14:58 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-22 13:15:30 -0400 |
commit | 29534cf13939c7f7fe59399f12d50df2fcab7a38 (patch) | |
tree | c7d5d25debc125007288ac8bd707dc215da862dc /lib | |
parent | 1d320fa48020407c997cb605c90b85e1ce15a89a (diff) | |
download | sqlalchemy-29534cf13939c7f7fe59399f12d50df2fcab7a38.tar.gz |
Don't emit pyodbc "no driver" warning for empty URL
Fixed an issue in the pyodbc connector such that a warning about pyodbc
"drivername" would be emitted when using a totally empty URL. Empty URLs
are normal when producing a non-connected dialect object or when using the
"creator" argument to create_engine(). The warning now only emits if the
driver name is missing but other parameters are still present.
Fixes: #5346
Change-Id: I0ee6f5fd5af7faca63bf0d7034410942f40834a8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/connectors/pyodbc.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/connectors/pyodbc.py b/lib/sqlalchemy/connectors/pyodbc.py index cd79a3ada..df1b2afdb 100644 --- a/lib/sqlalchemy/connectors/pyodbc.py +++ b/lib/sqlalchemy/connectors/pyodbc.py @@ -75,7 +75,8 @@ class PyODBCConnector(Connector): connectors = [] driver = keys.pop("driver", self.pyodbc_driver_name) - if driver is None: + if driver is None and keys: + # note if keys is empty, this is a totally blank URL util.warn( "No driver name specified; " "this is expected by PyODBC when using " |