Skip to content

Commit 8836545

Browse files
committed
fix: Possible errors caused by SQL ending with a semicolon
1 parent 17874ac commit 8836545

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

backend/apps/db/db.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ def get_fields(ds: CoreDatasource, table_name: str = None):
300300

301301

302302
def exec_sql(ds: CoreDatasource | AssistantOutDsSchema, sql: str, origin_column=False):
303+
while sql.endswith(';'):
304+
sql = sql[:-1]
305+
303306
db = DB.get_db(ds.type)
304307
if db.connect_type == ConnectType.sqlalchemy:
305308
with get_session(ds) as session:

0 commit comments

Comments
 (0)