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 2019/08/05 05:20:02 UTC

[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #7977: [DB Engine] Support old and new Presto syntax

mistercrunch commented on a change in pull request #7977: [DB Engine] Support old and new Presto syntax
URL: https://github.com/apache/incubator-superset/pull/7977#discussion_r310441109
 
 

 ##########
 File path: superset/db_engine_specs/presto.py
 ##########
 @@ -900,10 +902,19 @@ def _partition_query(cls, table_name, limit=0, order_by=None, filters=None):
                 l.append(f"{field} = '{value}'")
             where_clause = "WHERE " + " AND ".join(l)
 
+        presto_version = database.get_extra().get("version")
+
+        # Partition select syntax changed in v0.199, so check here.
+        # Default to the new syntax if version is unset.
+        partition_select_clause = (
+            f'SELECT * FROM "{table_name}$partitions"'
+            if not presto_version or presto_version >= "0.199"
 
 Review comment:
   I think you may want something like 
   ```
   version_tuple = lambda v: tuple(map(int, v.split('.')))
   version_tuple(presto_version) > (0, 199)
   ```

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