diff --git a/docs/installation.rst b/docs/installation.rst index be4abe8168b30..ca9cf3f595815 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -298,6 +298,8 @@ Here's a list of some of the recommended packages. +---------------+-------------------------------------+-------------------------------------------------+ | sqlite | | ``sqlite://`` | +---------------+-------------------------------------+-------------------------------------------------+ +| Snowflake | ``pip install snowflake-sqlalchemy``| ``snowflake://`` | ++---------------+-------------------------------------+-------------------------------------------------+ | Redshift | ``pip install sqlalchemy-redshift`` | ``redshift+psycopg2://`` | +---------------+-------------------------------------+-------------------------------------------------+ | MSSQL | ``pip install pymssql`` | ``mssql://`` | diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 0c7444c3f03ec..49dd39cd6d4aa 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -334,6 +334,22 @@ def get_table_names(cls, schema, inspector): return sorted(tables) +class SnowflakeEngineSpec(PostgresBaseEngineSpec): + engine = 'snowflake' + + time_grains = ( + Grain('Time Column', _('Time Column'), '{col}', None), + Grain('second', _('second'), "DATE_TRUNC('SECOND', {col})", 'PT1S'), + Grain('minute', _('minute'), "DATE_TRUNC('MINUTE', {col})", 'PT1M'), + Grain('hour', _('hour'), "DATE_TRUNC('HOUR', {col})", 'PT1H'), + Grain('day', _('day'), "DATE_TRUNC('DAY', {col})", 'P1D'), + Grain('week', _('week'), "DATE_TRUNC('WEEK', {col})", 'P1W'), + Grain('month', _('month'), "DATE_TRUNC('MONTH', {col})", 'P1M'), + Grain('quarter', _('quarter'), "DATE_TRUNC('QUARTER', {col})", 'P0.25Y'), + Grain('year', _('year'), "DATE_TRUNC('YEAR', {col})", 'P1Y'), + ) + + class VerticaEngineSpec(PostgresBaseEngineSpec): engine = 'vertica'