Skip to content

Commit 12e381f

Browse files
committed
Make test pass
1 parent 762903c commit 12e381f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/io/sql.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -736,13 +736,14 @@ def pandasSQL_builder(con, schema: str | None = None):
736736
if isinstance(con, sqlite3.Connection) or con is None:
737737
return SQLiteDatabase(con)
738738

739-
sqlalchemy = import_optional_dependency("sqlalchemy")
739+
sqlalchemy = import_optional_dependency("sqlalchemy", errors="ignore")
740740

741-
if isinstance(con, str):
742-
con = sqlalchemy.create_engine(con)
741+
if sqlalchemy is not None:
742+
if isinstance(con, str):
743+
con = sqlalchemy.create_engine(con)
743744

744-
if isinstance(con, sqlalchemy.engine.Connectable):
745-
return SQLDatabase(con, schema=schema)
745+
if isinstance(con, sqlalchemy.engine.Connectable):
746+
return SQLDatabase(con, schema=schema)
746747

747748
warnings.warn(
748749
"pandas only support SQLAlchemy connectable(engine/connection) or"

0 commit comments

Comments
 (0)