Skip to content

Commit cc62a61

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

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/io/sql.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1159,9 +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(
1163-
*args, **kwargs
1164-
)
1162+
return self.connectable.execution_options().execute(*args, **kwargs)
11651163

11661164
def read_table(
11671165
self,
@@ -1291,6 +1289,11 @@ def read_query(
12911289
read_sql
12921290
12931291
"""
1292+
if isinstance(sql, str) and params is None:
1293+
from sqlalchemy.sql import text
1294+
1295+
sql = text(sql)
1296+
12941297
args = _convert_params(sql, params)
12951298

12961299
result = self.execute(*args)

0 commit comments

Comments
 (0)