diff --git a/docs/index.rst b/docs/index.rst index 7727ff4eb..5a3a2748c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -109,6 +109,7 @@ The following RDBMS are currently supported: - `Apache Spark SQL `_ - `BigQuery `_ - `ClickHouse `_ +- `Dremio `_ - `Elasticsearch `_ - `Exasol `_ - `Google Sheets `_ diff --git a/docs/installation.rst b/docs/installation.rst index e9b8cbd94..3c339145b 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 aed85b45c..0b274e541 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 000000000..ba570b49a --- /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})"