From f7b2a7a19fba6919fdd9c9f30299fc85bebd0485 Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 3 Jun 2025 17:43:31 +0800 Subject: [PATCH 1/2] feat(datasource): exec sql --- backend/apps/db/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/db/db.py b/backend/apps/db/db.py index 5bdaaed1..473ae942 100644 --- a/backend/apps/db/db.py +++ b/backend/apps/db/db.py @@ -247,7 +247,7 @@ def exec_sql(ds: CoreDatasource, sql: str): {columns[i]: value for i, value in enumerate(tuple_item)} for tuple_item in res ] - return {"fields": columns, "data": result_list, "sql": base64.b64encode(bytes(sql, 'utf-8'))} + return {"fields": columns, "data": result_list, "sql": str(base64.b64encode(bytes(sql, 'utf-8')))} finally: if result is not None: result.close() From c4f1ccfe32b1ce0649fb9e1a18d4fb02948b70aa Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 3 Jun 2025 17:49:39 +0800 Subject: [PATCH 2/2] feat(datasource): exec sql --- backend/apps/db/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/db/db.py b/backend/apps/db/db.py index 473ae942..9378c27e 100644 --- a/backend/apps/db/db.py +++ b/backend/apps/db/db.py @@ -247,7 +247,7 @@ def exec_sql(ds: CoreDatasource, sql: str): {columns[i]: value for i, value in enumerate(tuple_item)} for tuple_item in res ] - return {"fields": columns, "data": result_list, "sql": str(base64.b64encode(bytes(sql, 'utf-8')))} + return {"fields": columns, "data": result_list, "sql": bytes.decode(base64.b64encode(bytes(sql, 'utf-8')))} finally: if result is not None: result.close()