DuanKuanJun commented on code in PR #32041:
URL: https://github.com/apache/superset/pull/32041#discussion_r1940408846
##########
superset/db_engine_specs/TDengine.py:
##########
@@ -0,0 +1,36 @@
+# TDengine driver for Apache SuperSet
+from superset.db_engine_specs.base import BaseEngineSpec
+from urllib import parse
+from typing import Any
+from sqlalchemy import types
+from sqlalchemy.engine.url import make_url, URL # noqa: F401
+
+class TDengineEngineSpec(BaseEngineSpec):
+ engine = "taosws"
+ engine_name = "TDengine"
+ max_column_name_length = 64
+ default_driver = "taosws"
+ sqlalchemy_uri_placeholder =
("taosws://user:******@host:port/dbname[?key=value&key=value...]")
+
+ # time grain
+ _time_grain_expressions = {
+ None: "{col}",
+ "PT1S": "TIMETRUNCATE({col}, 1s, 0)",
+ "PT1M": "TIMETRUNCATE({col}, 1m, 0)",
+ "PT1H": "TIMETRUNCATE({col}, 1h, 0)",
+ "P1D": "TIMETRUNCATE({col}, 1d, 0)",
+ "P1W": "TIMETRUNCATE({col}, 1w, 0)",
+ }
+
+ @classmethod
+ def get_schema_from_engine_params(
+ cls,
+ sqlalchemy_uri: URL,
+ connect_args: dict[str, Any],
+ ) -> Optional[str]:
Review Comment:
> Again, I would prefer not using `Optional`, and use the more modern `|
None` syntax that can be used if you add `from __future__ import annotations`.
resolve , done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]