From 1d852ab45a6edb7b4156ea02c0e40c72915cda18 Mon Sep 17 00:00:00 2001 From: sunpeng Date: Mon, 27 Feb 2023 11:59:58 +0800 Subject: [PATCH] fix: fix for sqlalchemy warning (#135) * fix: fix for sqlalchemy warning * fix test * create log dir on TDengine startup * change log dir and data dir for mac * fix for mac --- .github/workflows/mac.yml | 7 +++++-- taos/sqlalchemy.py | 11 +++++++++++ taosrest/sqlalchemy.py | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 7491dde3..c5b62c56 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -44,10 +44,13 @@ jobs: run: | export C_INCLUDE_PATH=$PWD/TDengine/build/build/include export LD_LIBRARY_PATH=$PWD/TDengine/build/build/lib - - taosadapter & + + mkdir -p /tmp/taos/v3/log /tmp/taos/v3/data + printf "dataDir /tmp/taos/v3/data\nlogDir /tmp/taos/v3/log\ndebugFlag 135\n" |sudo tee /etc/taos/taos.cfg TAOS_SUPPORT_VNODES=256 taosd & + taosadapter & + sleep 1 - name: Cache Poetry diff --git a/taos/sqlalchemy.py b/taos/sqlalchemy.py index 437e7d9d..ffb2d395 100644 --- a/taos/sqlalchemy.py +++ b/taos/sqlalchemy.py @@ -25,6 +25,7 @@ class TaosWsDialect(default.DefaultDialect): driver = "taosws" supports_native_boolean = True implicit_returning = True + supports_statement_cache = True def do_rollback(self, connection): pass @@ -39,6 +40,11 @@ def dbapi(cls): return taosws + @classmethod + def import_dbapi(cls): + import taosws + return taosws + def has_schema(self, connection, schema): return False @@ -87,6 +93,7 @@ class TaosDialect(default.DefaultDialect): driver = "taos" supports_native_boolean = True implicit_returning = True + supports_statement_cache = True def do_rollback(self, connection): pass @@ -98,6 +105,10 @@ def _get_server_version_info(self, connection): def dbapi(cls): return AlchemyTaosConnection() + @classmethod + def import_dbapi(cls): + return AlchemyTaosConnection() + def has_schema(self, connection, schema): return False diff --git a/taosrest/sqlalchemy.py b/taosrest/sqlalchemy.py index 9b69b34a..65934806 100644 --- a/taosrest/sqlalchemy.py +++ b/taosrest/sqlalchemy.py @@ -33,6 +33,7 @@ class TaosRestDialect(default.DefaultDialect): driver = "taosrest" supports_native_boolean = True implicit_returning = True + supports_statement_cache = True def do_rollback(self, connection): pass @@ -44,6 +45,10 @@ def _get_server_version_info(self, connection): def dbapi(cls): return AlchemyRestConnection() + @classmethod + def import_dbapi(cls): + return AlchemyRestConnection() + def has_schema(self, connection, schema): return False