You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/18 18:53:16 UTC

[GitHub] [incubator-superset] villebro commented on a change in pull request #9574: sybase db_engine_spec

villebro commented on a change in pull request #9574: sybase db_engine_spec
URL: https://github.com/apache/incubator-superset/pull/9574#discussion_r410736157
 
 

 ##########
 File path: superset/db_engine_specs/sybase.py
 ##########
 @@ -0,0 +1,21 @@
+# 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 superset.db_engine_specs.mssql import MssqlEngineSpec
+
+
+class SybaseEngineSpec(MssqlEngineSpec):
+    engine = "sybase"
 
 Review comment:
   In my experience, extending an existing engine spec is usually a bad pattern, and based on very quick googling Sybase doesn't seem to be directly related to MSSQL (I have zero experience with Sybase, unfortunately). If you wish, you can copy the contents of `mssql.py` into `sybase.py`, and then start tweaking from there. However, if Sybase and MSSQL have a lot in common, this might not be necessary.
   
   There are a few minimum features that a b engine spec need, namely:
   - time grain expressions: these are expressions that round dates, datetimes and timestamps down to a wanted timegrain. Without time grains your Superset experience will be very limited. If the MSSQL time grains work with Sybase, you won't need to reinvent the wheel here.
   - `epoch_to_dttm`  method: this defines an expression that takes an epoch (seconds since 1970-01-01 00:00:00) and changes it to a datetime. Again, if the MSSQL version works, use that.
   - `convert_dttm` method: expression for casting a python `datetime` into a DATE/DATETIME/TIMESTAMP type in the given SQL dialect.
   
   We also try to add unit tests for all db engine specs nowadays (check `tests/db_engine_specs/`), but don't worry about that if you don't feel comfortable writing tests.
   
   Oh, please feel free to reach out on Slack if you need help 🙂  Good luck!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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