You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/01/10 15:37:55 UTC
[incubator-superset] branch master updated: Add support for Dremio
as a new source (#8939)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 3bedee7 Add support for Dremio as a new source (#8939)
3bedee7 is described below
commit 3bedee75d37af0ed137a14e3f739ed3e09cc227d
Author: Naren <na...@users.noreply.github.com>
AuthorDate: Fri Jan 10 10:37:40 2020 -0500
Add support for Dremio as a new source (#8939)
* Added spec for Dremio
* Installation instructions for Dremio
* added dependency for dremio
* Update dremio.py
* ASF header, dttm, set min version in setup.py
* Update installation.rst
* Update installation.rst
* fix tox 'Title underline too short.'
* change URI example
Co-authored-by: Naren <41...@users.noreply.github.com>
---
docs/index.rst | 1 +
docs/installation.rst | 11 +++++++++++
setup.py | 1 +
superset/db_engine_specs/dremio.py | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 51 insertions(+)
diff --git a/docs/index.rst b/docs/index.rst
index 7727ff4..5a3a274 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -109,6 +109,7 @@ The following RDBMS are currently supported:
- `Apache Spark SQL <https://spark.apache.org/sql/>`_
- `BigQuery <https://cloud.google.com/bigquery/>`_
- `ClickHouse <https://clickhouse.yandex/>`_
+- `Dremio <https://dremio.com/>`_
- `Elasticsearch <https://www.elastic.co/products/elasticsearch/>`_
- `Exasol <https://www.exasol.com/>`_
- `Google Sheets <https://www.google.com/sheets/about/>`_
diff --git a/docs/installation.rst b/docs/installation.rst
index e9b8cbd..3c33914 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -372,6 +372,8 @@ Here's a list of some of the recommended packages.
+------------------+---------------------------------------+-------------------------------------------------+
| ClickHouse | ``pip install sqlalchemy-clickhouse`` | |
+------------------+---------------------------------------+-------------------------------------------------+
+| Dremio | ``pip install sqlalchemy_dremio`` | ``dremio://user:pwd@host:31010/`` |
++------------------+---------------------------------------+-------------------------------------------------+
| Elasticsearch | ``pip install elasticsearch-dbapi`` | ``elasticsearch+http://`` |
+------------------+---------------------------------------+-------------------------------------------------+
| Exasol | ``pip install sqlalchemy-exasol`` | ``exa+pyodbc://`` |
@@ -724,6 +726,15 @@ Druid
Note that you can run the ``superset refresh_druid`` command to refresh the
metadata from your Druid cluster(s)
+Dremio
+------
+
+Install the following dependencies to connect to Dremio:
+
+* Dremio SQLAlchemy: ``pip install sqlalchemy_dremio``
+* Dremio's ODBC driver: https://www.dremio.com/drivers/
+
+Example SQLAlchemy URI: ``dremio://dremio:dremio123@localhost:31010/dremio``
Presto
------
diff --git a/setup.py b/setup.py
index aed85b4..0b274e5 100644
--- a/setup.py
+++ b/setup.py
@@ -118,6 +118,7 @@ setup(
"elasticsearch": ["elasticsearch-dbapi>=0.1.0, <0.2.0"],
"druid": ["pydruid==0.5.7", "requests==2.22.0"],
"hana": ["hdbcli==2.4.162", "sqlalchemy_hana==0.4.0"],
+ "dremio": ["sqlalchemy_dremio>=0.5.0dev0"],
},
python_requires="~=3.6",
author="Apache Software Foundation",
diff --git a/superset/db_engine_specs/dremio.py b/superset/db_engine_specs/dremio.py
new file mode 100644
index 0000000..ba570b4
--- /dev/null
+++ b/superset/db_engine_specs/dremio.py
@@ -0,0 +1,38 @@
+# 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.base import BaseEngineSpec
+
+
+class DremioBaseEngineSpec(BaseEngineSpec):
+
+ engine = "dremio"
+
+ _time_grain_functions = {
+ None: "{col}",
+ "PT1S": "DATE_TRUNC('second', {col})",
+ "PT1M": "DATE_TRUNC('minute', {col})",
+ "PT1H": "DATE_TRUNC('hour', {col})",
+ "P1D": "DATE_TRUNC('day', {col})",
+ "P1W": "DATE_TRUNC('week', {col})",
+ "P1M": "DATE_TRUNC('month', {col})",
+ "P0.25Y": "DATE_TRUNC('quarter', {col})",
+ "P1Y": "DATE_TRUNC('year', {col})",
+ }
+
+ @classmethod
+ def epoch_to_dttm(cls) -> str:
+ return "TO_DATE({col})"