|
2 | 2 | from datetime import datetime
|
3 | 3 | from typing import Any
|
4 | 4 |
|
| 5 | +from timeplus_connect.tp_superset.sql_parse import TimeplusSqlglotDialect |
| 6 | + |
5 | 7 | # pylint:disable=E0401
|
6 | 8 | from marshmallow import fields, Schema
|
7 | 9 | from marshmallow.validate import Range
|
8 | 10 | from superset.db_engine_specs.base import BaseEngineSpec
|
9 | 11 | from superset.utils import core as utils
|
| 12 | +from superset.sql.parse import SQLGLOT_DIALECTS |
10 | 13 |
|
11 | 14 | from sqlalchemy import types
|
12 | 15 | from sqlalchemy.engine.url import URL
|
|
35 | 38 | except ImportError: # Timeplus Connect not installed, do nothing
|
36 | 39 | pass
|
37 | 40 |
|
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
38 | 45 | class TimeplusParametersSchema(Schema):
|
39 | 46 | username = fields.String(allow_none=True, metadata={"description": utils.__("Username")})
|
40 | 47 | password = fields.String(allow_none=True, metadata={"description": utils.__("Password")})
|
@@ -69,6 +76,11 @@ class TimeplusEngineSpec(BaseEngineSpec):
|
69 | 76 | _show_functions_column = "name"
|
70 | 77 | supports_file_upload = False
|
71 | 78 |
|
| 79 | + SQLGLOT_DIALECTS["timeplus"] = TimeplusSqlglotDialect |
| 80 | + SQLGLOT_DIALECTS["timeplusdb"] = TimeplusSqlglotDialect |
| 81 | + |
| 82 | + print("SQLGLOT_DIALECTS: ========================", SQLGLOT_DIALECTS) |
| 83 | + |
72 | 84 | sqlalchemy_uri_placeholder = (
|
73 | 85 | "timeplusdb://user:password@host[:port][/dbname][?secure=value&=value...]"
|
74 | 86 | )
|
@@ -126,3 +138,5 @@ def build_sqlalchemy_uri(
|
126 | 138 | url_params["database"] = "default"
|
127 | 139 | url_params.pop("encryption", None)
|
128 | 140 | return str(URL.create(f"{cls.engine}", **url_params))
|
| 141 | + |
| 142 | + |
0 commit comments