Skip to content

Commit 5a3775c

Browse files
committed
add sqlglot dialect
1 parent d35e6fc commit 5a3775c

File tree

4 files changed

+1273
-2
lines changed

4 files changed

+1273
-2
lines changed

timeplus_connect/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.8.15'
1+
version = '0.8.14'
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from timeplus_connect.tp_superset.db_engine_spec import TimeplusEngineSpec
1+
import timeplus_connect.tp_superset.db_engine_spec
2+
import timeplus_connect.tp_superset.sql_parse
3+

timeplus_connect/tp_superset/db_engine_spec.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
from datetime import datetime
33
from typing import Any
44

5+
from timeplus_connect.tp_superset.sql_parse import TimeplusSqlglotDialect
6+
57
# pylint:disable=E0401
68
from marshmallow import fields, Schema
79
from marshmallow.validate import Range
810
from superset.db_engine_specs.base import BaseEngineSpec
911
from superset.utils import core as utils
12+
from superset.sql.parse import SQLGLOT_DIALECTS
1013

1114
from sqlalchemy import types
1215
from sqlalchemy.engine.url import URL
@@ -35,6 +38,10 @@
3538
except ImportError: # Timeplus Connect not installed, do nothing
3639
pass
3740

41+
42+
43+
44+
3845
class TimeplusParametersSchema(Schema):
3946
username = fields.String(allow_none=True, metadata={"description": utils.__("Username")})
4047
password = fields.String(allow_none=True, metadata={"description": utils.__("Password")})
@@ -69,6 +76,11 @@ class TimeplusEngineSpec(BaseEngineSpec):
6976
_show_functions_column = "name"
7077
supports_file_upload = False
7178

79+
SQLGLOT_DIALECTS["timeplus"] = TimeplusSqlglotDialect
80+
SQLGLOT_DIALECTS["timeplusdb"] = TimeplusSqlglotDialect
81+
82+
print("SQLGLOT_DIALECTS: ========================", SQLGLOT_DIALECTS)
83+
7284
sqlalchemy_uri_placeholder = (
7385
"timeplusdb://user:password@host[:port][/dbname][?secure=value&=value...]"
7486
)
@@ -126,3 +138,5 @@ def build_sqlalchemy_uri(
126138
url_params["database"] = "default"
127139
url_params.pop("encryption", None)
128140
return str(URL.create(f"{cls.engine}", **url_params))
141+
142+

0 commit comments

Comments
 (0)