From 1cc438294a20ef2103ecfec95b2fefe18bb39fe5 Mon Sep 17 00:00:00 2001 From: junjun Date: Tue, 22 Jul 2025 16:53:34 +0800 Subject: [PATCH] fix: sqlserver encode --- backend/apps/datasource/models/datasource.py | 4 ++-- backend/apps/db/db.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/apps/datasource/models/datasource.py b/backend/apps/datasource/models/datasource.py index 4377344a..08e38ca9 100644 --- a/backend/apps/datasource/models/datasource.py +++ b/backend/apps/datasource/models/datasource.py @@ -99,7 +99,7 @@ class DatasourceConf(BaseModel): class TableSchema: def __init__(self, attr1, attr2): self.tableName = attr1 - self.tableComment = attr2 + self.tableComment = attr2 if isinstance(attr2, str) else attr2.decode("utf-8") tableName: str tableComment: str @@ -109,7 +109,7 @@ class ColumnSchema: def __init__(self, attr1, attr2, attr3): self.fieldName = attr1 self.fieldType = attr2 - self.fieldComment = attr3 + self.fieldComment = attr3 if isinstance(attr3, str) else attr3.decode("utf-8") fieldName: str fieldType: str diff --git a/backend/apps/db/db.py b/backend/apps/db/db.py index 84f25aea..729720db 100644 --- a/backend/apps/db/db.py +++ b/backend/apps/db/db.py @@ -61,10 +61,15 @@ def get_engine(ds: CoreDatasource) -> Engine: connect_args={"options": f"-c search_path={conf.dbSchema}", "connect_timeout": conf.timeout}, pool_timeout=conf.timeout, pool_size=20, max_overflow=10) - elif ds.type == 'oracle' or ds.type == 'sqlServer': + elif ds.type == 'sqlServer': engine = create_engine(get_uri(ds), pool_timeout=conf.timeout, pool_size=20, max_overflow=10) + elif ds.type == 'oracle': + engine = create_engine(get_uri(ds), + pool_timeout=conf.timeout, + pool_size=20, + max_overflow=10) else: engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, pool_timeout=conf.timeout, pool_size=20,