villebro commented on a change in pull request #8150: add-hana
URL:
https://github.com/apache/incubator-superset/pull/8150#discussion_r319710756
##########
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'",
Review comment:
It seems `P1D` returns a `DATE` type while the others return some form of
`STRING`. I believe these should all be cast to a `DATE`/`DATETIME` type or
similar. Furthermore, would you be able to provide definitions for other time
grains, like week, minute and second?
----------------------------------------------------------------
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]