Skip to content

Commit 1b83922

Browse files
committed
BUG: allow sql using %% with postgres (pandas-dev#35484)
1 parent d9f487a commit 1b83922

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/io/sql.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ def run_transaction(self):
11591159

11601160
def execute(self, *args, **kwargs):
11611161
"""Simple passthrough to SQLAlchemy connectable"""
1162-
return self.connectable.execution_options(no_parameters=True).execute(
1162+
return self.connectable.execution_options().execute(
11631163
*args, **kwargs
11641164
)
11651165

@@ -1291,6 +1291,10 @@ def read_query(
12911291
read_sql
12921292
12931293
"""
1294+
if isinstance(sql, str) and params is None:
1295+
from sqlalchemy.sql import text
1296+
sql = text(sql)
1297+
12941298
args = _convert_params(sql, params)
12951299

12961300
result = self.execute(*args)

0 commit comments

Comments
 (0)