villebro commented on code in PR #32041:
URL: https://github.com/apache/superset/pull/32041#discussion_r1938588413


##########
superset/db_engine_specs/TDengine.py:
##########
@@ -0,0 +1,36 @@
+# TDengine driver for Apache SuperSet

Review Comment:
   This is redundant. Also, you need to include the license header in this file 
(you can just copy it from any other file).
   ```suggestion
   ```



##########
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:
   We should use `str | None` notation here. To be able to use that, you need 
to `from __future__ import annotations` to make sure the new syntax is 
supported.
   ```suggestion
       ) -> str | None:
   ```



-- 
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]

Reply via email to