vgvoleg commented on code in PR #31141:
URL: https://github.com/apache/superset/pull/31141#discussion_r1858125130


##########
superset/db_engine_specs/ydb.py:
##########
@@ -0,0 +1,94 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+import json
+import logging
+from typing import (
+    Any,
+    TYPE_CHECKING,
+)
+
+from superset.constants import TimeGrain
+from superset.db_engine_specs.base import BaseEngineSpec
+
+if TYPE_CHECKING:
+    from superset.models.core import Database
+
+
+logger = logging.getLogger(__name__)
+
+
+class YDBEngineSpec(BaseEngineSpec):
+    engine = "yql"
+    engine_aliases = {"ydb", "yql+ydb"}
+    engine_name = "YDB"
+
+    default_driver = "ydb"
+
+    sqlalchemy_uri_placeholder = (
+        "ydb://{host}:{port}/{database_name}"
+    )
+
+    encrypted_extra_sensitive_fields = {"$.connect_args.credentials", 
"$.credentials"}
+
+    supports_file_upload = False
+
+    _time_grain_expressions = {

Review Comment:
   It is needed for one test to pass (it checks that len of this dict is 
greater than 0)
   I had an issue with generated query after filling this dict in correct for 
YDB way https://apache-superset.slack.com/archives/C014LS99C1K/p1732544528541239
   
   TLDR we can't work with generated queries because YDB expecting something 
like
   
   ```
   SELECT DateTime::StartOf(date, Interval('P1D')) AS date, count(client_id) AS 
`COUNT(client_id)` 
   FROM (SELECT * from transactions_data
   ) AS virtual_table GROUP BY date ORDER BY `COUNT(client_id)` DESC
    LIMIT CAST(1000 AS UInt64);
   ```
   
   instead of
   
   ```
   SELECT DateTime::StartOf(date, Interval('P1D')) AS date, count(client_id) AS 
`COUNT(client_id)` 
   FROM (SELECT * from transactions_data
   ) AS virtual_table GROUP BY DateTime::StartOf(date, Interval('P1D')) AS date 
ORDER BY `COUNT(client_id)` DESC
    LIMIT CAST(1000 AS UInt64);
   ```
   
   Let me know if I can override something to make group by use aliases as well 
as order by.



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to