From 06d4b4aa76946c951c4af5509a2080acae954def Mon Sep 17 00:00:00 2001 From: anirudhjoshi Date: Tue, 12 Jan 2016 17:44:49 +1100 Subject: [PATCH] BUG: Raise ImportError when provided URI, but sqlalchemy is not installed. Rather than presume that it is an sqlite database and provide a confusing error. --- pandas/io/sql.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 95a6d02b1ccb6..b808797a99be8 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -631,6 +631,8 @@ def pandasSQL_builder(con, flavor=None, schema=None, meta=None, con = _engine_builder(con) if _is_sqlalchemy_connectable(con): return SQLDatabase(con, schema=schema, meta=meta) + elif isinstance(con, string_types): + raise ImportError("Using URI string without sqlalchemy installed.") else: if flavor == 'mysql': warnings.warn(_MYSQL_WARNING, FutureWarning, stacklevel=3)