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 <41924335+naren-dremio@users.noreply.github.com>
This commit is contained in:
Naren 2020-01-10 10:37:40 -05:00 committed by Ville Brofeldt
parent 5b2499984d
commit 3bedee75d3
4 changed files with 51 additions and 0 deletions

View File

@ -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/>`_

View File

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

View File

@ -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",

View File

@ -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})"