villebro commented on a change in pull request #8150: add-hana
URL:
https://github.com/apache/incubator-superset/pull/8150#discussion_r319710915
##########
File path: superset/db_engine_specs/hana.py
##########
@@ -0,0 +1,59 @@
+from superset.db_engine_specs.base import LimitMethod
+from superset.db_engine_specs.postgres import PostgresBaseEngineSpec
+
+
+class HanaPyhdbEngineSpec(PostgresBaseEngineSpec):
+ engine = "hana+pyhdb"
+ limit_method = LimitMethod.WRAP_SQL
+ force_column_alias_quotes = True
+ max_column_name_length = 30
+ time_grain_functions = {
+ None: '{col}',
+ 'P1D': "TO_DATE({col})",
+ 'P1M': "SUBSTRING(to_date({col}),0,7)||'-01'",
+ 'P0.25Y':
"SUBSTRING(to_date({col}),0,5)||'0'||SUBSTRING(QUARTER(TO_DATE({col}),
1),7,1)||'-01'",
+ 'P1Y': "YEAR({col})||'-01-01'",
+ }
+ @classmethod
+ def convert_dttm(cls, target_type, dttm):
+ return ("""to_date('{}'""").format(
+ dttm.isoformat()
+ )
+
+class HanaEngineSpec(PostgresBaseEngineSpec):
Review comment:
This class can be removed if the main class is changed to `engine = "hana"`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]