From 58bb425dab4b05e1dea489cbdad7d5590f6546f3 Mon Sep 17 00:00:00 2001 From: Mike Gouline <1960272+gouline@users.noreply.github.com> Date: Tue, 9 Jan 2024 20:13:12 +1100 Subject: [PATCH] Restructure models for better readability --- Makefile | 36 +- dbtmetabase/__init__.py | 11 +- dbtmetabase/__main__.py | 390 +- dbtmetabase/_format.py | 121 +- dbtmetabase/core.py | 133 + dbtmetabase/core_exposures.py | 463 ++ dbtmetabase/core_model.py | 419 ++ dbtmetabase/dbt.py | 509 -- dbtmetabase/interface.py | 36 + dbtmetabase/manifest.py | 355 + dbtmetabase/metabase.py | 970 --- sandbox/entrypoint.py | 153 +- tests/__init__.py | 11 +- tests/_mocks.py | 538 ++ tests/fixtures/api/card.json | 2497 +++++++ tests/fixtures/api/card/1.json | 175 + tests/fixtures/api/card/10.json | 186 + tests/fixtures/api/card/11.json | 186 + tests/fixtures/api/card/12.json | 145 + tests/fixtures/api/card/13.json | 145 + tests/fixtures/api/card/14.json | 145 + tests/fixtures/api/card/15.json | 145 + tests/fixtures/api/card/16.json | 145 + tests/fixtures/api/card/17.json | 145 + tests/fixtures/api/card/2.json | 90 + tests/fixtures/api/card/3.json | 90 + tests/fixtures/api/card/4.json | 111 + tests/fixtures/api/card/5.json | 111 + tests/fixtures/api/card/6.json | 155 + tests/fixtures/api/card/7.json | 155 + tests/fixtures/api/card/8.json | 186 + tests/fixtures/api/card/9.json | 186 + tests/fixtures/api/collection.json | 49 + tests/fixtures/api/collection/1.json | 23 + tests/fixtures/api/collection/2.json | 23 + tests/fixtures/api/collection/2/items.json | 9 + tests/fixtures/api/collection/3.json | 28 + tests/fixtures/api/collection/3/items.json | 257 + tests/fixtures/api/collection/root/items.json | 48 + tests/fixtures/api/dashboard.json | 54 + tests/fixtures/api/dashboard/1.json | 2533 +++++++ tests/fixtures/api/database.json | 51 + .../{mock_api => }/api/database/2.json | 2 +- tests/fixtures/api/database/2/metadata.json | 1860 +++++ tests/fixtures/api/field/37.json | 111 + tests/fixtures/api/field/38.json | 112 + tests/fixtures/api/field/39.json | 108 + tests/fixtures/api/field/40.json | 112 + tests/fixtures/api/field/41.json | 112 + tests/fixtures/api/field/42.json | 108 + tests/fixtures/api/field/43.json | 111 + tests/fixtures/api/field/44.json | 112 + tests/fixtures/api/field/45.json | 112 + tests/fixtures/api/field/46.json | 108 + tests/fixtures/api/field/47.json | 112 + tests/fixtures/api/field/48.json | 112 + tests/fixtures/api/field/49.json | 112 + tests/fixtures/api/field/50.json | 111 + tests/fixtures/api/field/51.json | 112 + tests/fixtures/api/field/52.json | 112 + tests/fixtures/api/field/53.json | 111 + tests/fixtures/api/field/54.json | 111 + tests/fixtures/api/field/55.json | 104 + tests/fixtures/api/field/56.json | 108 + tests/fixtures/api/field/57.json | 97 + tests/fixtures/api/field/58.json | 111 + tests/fixtures/api/field/59.json | 112 + tests/fixtures/api/field/60.json | 112 + tests/fixtures/api/field/61.json | 111 + tests/fixtures/api/field/62.json | 97 + tests/fixtures/api/field/63.json | 112 + tests/fixtures/api/field/64.json | 111 + tests/fixtures/api/field/65.json | 112 + tests/fixtures/api/field/66.json | 111 + tests/fixtures/api/field/67.json | 108 + tests/fixtures/api/field/68.json | 112 + tests/fixtures/api/field/69.json | 111 + tests/fixtures/api/field/70.json | 112 + tests/fixtures/api/field/71.json | 112 + tests/fixtures/api/field/72.json | 111 + tests/fixtures/api/field/73.json | 112 + tests/fixtures/api/field/74.json | 112 + tests/fixtures/{mock_api => }/api/metric.json | 0 tests/fixtures/api/table.json | 530 ++ tests/fixtures/api/table/10.json | 67 + tests/fixtures/api/table/11.json | 67 + tests/fixtures/api/table/12.json | 67 + tests/fixtures/api/table/5.json | 67 + tests/fixtures/api/table/6.json | 67 + tests/fixtures/api/table/7.json | 67 + tests/fixtures/api/table/8.json | 67 + tests/fixtures/api/table/9.json | 67 + tests/fixtures/api/user.json | 24 + tests/fixtures/api/user/1.json | 21 + tests/fixtures/dbt/manifest.json | 1 - tests/fixtures/manifest.json | 6081 +++++++++++++++++ tests/fixtures/mock_api/api/card.json | 1 - tests/fixtures/mock_api/api/card/1.json | 1 - tests/fixtures/mock_api/api/card/10.json | 1 - tests/fixtures/mock_api/api/card/11.json | 1 - tests/fixtures/mock_api/api/card/12.json | 1 - tests/fixtures/mock_api/api/card/13.json | 1 - tests/fixtures/mock_api/api/card/14.json | 1 - tests/fixtures/mock_api/api/card/15.json | 1 - tests/fixtures/mock_api/api/card/16.json | 1 - tests/fixtures/mock_api/api/card/17.json | 1 - tests/fixtures/mock_api/api/card/2.json | 1 - tests/fixtures/mock_api/api/card/3.json | 1 - tests/fixtures/mock_api/api/card/4.json | 1 - tests/fixtures/mock_api/api/card/5.json | 1 - tests/fixtures/mock_api/api/card/6.json | 1 - tests/fixtures/mock_api/api/card/7.json | 1 - tests/fixtures/mock_api/api/card/8.json | 1 - tests/fixtures/mock_api/api/card/9.json | 1 - tests/fixtures/mock_api/api/collection.json | 1 - tests/fixtures/mock_api/api/collection/1.json | 1 - tests/fixtures/mock_api/api/collection/2.json | 1 - .../mock_api/api/collection/2/items.json | 1 - tests/fixtures/mock_api/api/collection/3.json | 1 - .../mock_api/api/collection/3/items.json | 1 - .../mock_api/api/collection/root/items.json | 1 - tests/fixtures/mock_api/api/dashboard.json | 1 - tests/fixtures/mock_api/api/dashboard/1.json | 1 - tests/fixtures/mock_api/api/database.json | 1 - .../mock_api/api/database/2/metadata.json | 1 - tests/fixtures/mock_api/api/field/37.json | 1 - tests/fixtures/mock_api/api/field/38.json | 1 - tests/fixtures/mock_api/api/field/39.json | 1 - tests/fixtures/mock_api/api/field/40.json | 1 - tests/fixtures/mock_api/api/field/41.json | 1 - tests/fixtures/mock_api/api/field/42.json | 1 - tests/fixtures/mock_api/api/field/43.json | 1 - tests/fixtures/mock_api/api/field/44.json | 1 - tests/fixtures/mock_api/api/field/45.json | 1 - tests/fixtures/mock_api/api/field/46.json | 1 - tests/fixtures/mock_api/api/field/47.json | 1 - tests/fixtures/mock_api/api/field/48.json | 1 - tests/fixtures/mock_api/api/field/49.json | 1 - tests/fixtures/mock_api/api/field/50.json | 1 - tests/fixtures/mock_api/api/field/51.json | 1 - tests/fixtures/mock_api/api/field/52.json | 1 - tests/fixtures/mock_api/api/field/53.json | 1 - tests/fixtures/mock_api/api/field/54.json | 1 - tests/fixtures/mock_api/api/field/55.json | 1 - tests/fixtures/mock_api/api/field/56.json | 1 - tests/fixtures/mock_api/api/field/57.json | 1 - tests/fixtures/mock_api/api/field/58.json | 1 - tests/fixtures/mock_api/api/field/59.json | 1 - tests/fixtures/mock_api/api/field/60.json | 1 - tests/fixtures/mock_api/api/field/61.json | 1 - tests/fixtures/mock_api/api/field/62.json | 1 - tests/fixtures/mock_api/api/field/63.json | 1 - tests/fixtures/mock_api/api/field/64.json | 1 - tests/fixtures/mock_api/api/field/65.json | 1 - tests/fixtures/mock_api/api/field/66.json | 1 - tests/fixtures/mock_api/api/field/67.json | 1 - tests/fixtures/mock_api/api/field/68.json | 1 - tests/fixtures/mock_api/api/field/69.json | 1 - tests/fixtures/mock_api/api/field/70.json | 1 - tests/fixtures/mock_api/api/field/71.json | 1 - tests/fixtures/mock_api/api/field/72.json | 1 - tests/fixtures/mock_api/api/field/73.json | 1 - tests/fixtures/mock_api/api/field/74.json | 1 - tests/fixtures/mock_api/api/table.json | 1 - tests/fixtures/mock_api/api/table/10.json | 1 - tests/fixtures/mock_api/api/table/11.json | 1 - tests/fixtures/mock_api/api/table/12.json | 1 - tests/fixtures/mock_api/api/table/5.json | 1 - tests/fixtures/mock_api/api/table/6.json | 1 - tests/fixtures/mock_api/api/table/7.json | 1 - tests/fixtures/mock_api/api/table/8.json | 1 - tests/fixtures/mock_api/api/table/9.json | 1 - tests/fixtures/mock_api/api/user.json | 1 - tests/fixtures/mock_api/api/user/1.json | 1 - tests/test_core_exposures.py | 76 + tests/test_core_models.py | 63 + tests/test_dbt.py | 269 - tests/test_manifest.py | 14 + tests/test_metabase.py | 402 -- 179 files changed, 23865 insertions(+), 2497 deletions(-) create mode 100644 dbtmetabase/core.py create mode 100644 dbtmetabase/core_exposures.py create mode 100644 dbtmetabase/core_model.py delete mode 100644 dbtmetabase/dbt.py create mode 100644 dbtmetabase/interface.py create mode 100644 dbtmetabase/manifest.py delete mode 100644 dbtmetabase/metabase.py create mode 100644 tests/_mocks.py create mode 100644 tests/fixtures/api/card.json create mode 100644 tests/fixtures/api/card/1.json create mode 100644 tests/fixtures/api/card/10.json create mode 100644 tests/fixtures/api/card/11.json create mode 100644 tests/fixtures/api/card/12.json create mode 100644 tests/fixtures/api/card/13.json create mode 100644 tests/fixtures/api/card/14.json create mode 100644 tests/fixtures/api/card/15.json create mode 100644 tests/fixtures/api/card/16.json create mode 100644 tests/fixtures/api/card/17.json create mode 100644 tests/fixtures/api/card/2.json create mode 100644 tests/fixtures/api/card/3.json create mode 100644 tests/fixtures/api/card/4.json create mode 100644 tests/fixtures/api/card/5.json create mode 100644 tests/fixtures/api/card/6.json create mode 100644 tests/fixtures/api/card/7.json create mode 100644 tests/fixtures/api/card/8.json create mode 100644 tests/fixtures/api/card/9.json create mode 100644 tests/fixtures/api/collection.json create mode 100644 tests/fixtures/api/collection/1.json create mode 100644 tests/fixtures/api/collection/2.json create mode 100644 tests/fixtures/api/collection/2/items.json create mode 100644 tests/fixtures/api/collection/3.json create mode 100644 tests/fixtures/api/collection/3/items.json create mode 100644 tests/fixtures/api/collection/root/items.json create mode 100644 tests/fixtures/api/dashboard.json create mode 100644 tests/fixtures/api/dashboard/1.json create mode 100644 tests/fixtures/api/database.json rename tests/fixtures/{mock_api => }/api/database/2.json (99%) create mode 100644 tests/fixtures/api/database/2/metadata.json create mode 100644 tests/fixtures/api/field/37.json create mode 100644 tests/fixtures/api/field/38.json create mode 100644 tests/fixtures/api/field/39.json create mode 100644 tests/fixtures/api/field/40.json create mode 100644 tests/fixtures/api/field/41.json create mode 100644 tests/fixtures/api/field/42.json create mode 100644 tests/fixtures/api/field/43.json create mode 100644 tests/fixtures/api/field/44.json create mode 100644 tests/fixtures/api/field/45.json create mode 100644 tests/fixtures/api/field/46.json create mode 100644 tests/fixtures/api/field/47.json create mode 100644 tests/fixtures/api/field/48.json create mode 100644 tests/fixtures/api/field/49.json create mode 100644 tests/fixtures/api/field/50.json create mode 100644 tests/fixtures/api/field/51.json create mode 100644 tests/fixtures/api/field/52.json create mode 100644 tests/fixtures/api/field/53.json create mode 100644 tests/fixtures/api/field/54.json create mode 100644 tests/fixtures/api/field/55.json create mode 100644 tests/fixtures/api/field/56.json create mode 100644 tests/fixtures/api/field/57.json create mode 100644 tests/fixtures/api/field/58.json create mode 100644 tests/fixtures/api/field/59.json create mode 100644 tests/fixtures/api/field/60.json create mode 100644 tests/fixtures/api/field/61.json create mode 100644 tests/fixtures/api/field/62.json create mode 100644 tests/fixtures/api/field/63.json create mode 100644 tests/fixtures/api/field/64.json create mode 100644 tests/fixtures/api/field/65.json create mode 100644 tests/fixtures/api/field/66.json create mode 100644 tests/fixtures/api/field/67.json create mode 100644 tests/fixtures/api/field/68.json create mode 100644 tests/fixtures/api/field/69.json create mode 100644 tests/fixtures/api/field/70.json create mode 100644 tests/fixtures/api/field/71.json create mode 100644 tests/fixtures/api/field/72.json create mode 100644 tests/fixtures/api/field/73.json create mode 100644 tests/fixtures/api/field/74.json rename tests/fixtures/{mock_api => }/api/metric.json (100%) create mode 100644 tests/fixtures/api/table.json create mode 100644 tests/fixtures/api/table/10.json create mode 100644 tests/fixtures/api/table/11.json create mode 100644 tests/fixtures/api/table/12.json create mode 100644 tests/fixtures/api/table/5.json create mode 100644 tests/fixtures/api/table/6.json create mode 100644 tests/fixtures/api/table/7.json create mode 100644 tests/fixtures/api/table/8.json create mode 100644 tests/fixtures/api/table/9.json create mode 100644 tests/fixtures/api/user.json create mode 100644 tests/fixtures/api/user/1.json delete mode 100644 tests/fixtures/dbt/manifest.json create mode 100644 tests/fixtures/manifest.json delete mode 100644 tests/fixtures/mock_api/api/card.json delete mode 100644 tests/fixtures/mock_api/api/card/1.json delete mode 100644 tests/fixtures/mock_api/api/card/10.json delete mode 100644 tests/fixtures/mock_api/api/card/11.json delete mode 100644 tests/fixtures/mock_api/api/card/12.json delete mode 100644 tests/fixtures/mock_api/api/card/13.json delete mode 100644 tests/fixtures/mock_api/api/card/14.json delete mode 100644 tests/fixtures/mock_api/api/card/15.json delete mode 100644 tests/fixtures/mock_api/api/card/16.json delete mode 100644 tests/fixtures/mock_api/api/card/17.json delete mode 100644 tests/fixtures/mock_api/api/card/2.json delete mode 100644 tests/fixtures/mock_api/api/card/3.json delete mode 100644 tests/fixtures/mock_api/api/card/4.json delete mode 100644 tests/fixtures/mock_api/api/card/5.json delete mode 100644 tests/fixtures/mock_api/api/card/6.json delete mode 100644 tests/fixtures/mock_api/api/card/7.json delete mode 100644 tests/fixtures/mock_api/api/card/8.json delete mode 100644 tests/fixtures/mock_api/api/card/9.json delete mode 100644 tests/fixtures/mock_api/api/collection.json delete mode 100644 tests/fixtures/mock_api/api/collection/1.json delete mode 100644 tests/fixtures/mock_api/api/collection/2.json delete mode 100644 tests/fixtures/mock_api/api/collection/2/items.json delete mode 100644 tests/fixtures/mock_api/api/collection/3.json delete mode 100644 tests/fixtures/mock_api/api/collection/3/items.json delete mode 100644 tests/fixtures/mock_api/api/collection/root/items.json delete mode 100644 tests/fixtures/mock_api/api/dashboard.json delete mode 100644 tests/fixtures/mock_api/api/dashboard/1.json delete mode 100644 tests/fixtures/mock_api/api/database.json delete mode 100644 tests/fixtures/mock_api/api/database/2/metadata.json delete mode 100644 tests/fixtures/mock_api/api/field/37.json delete mode 100644 tests/fixtures/mock_api/api/field/38.json delete mode 100644 tests/fixtures/mock_api/api/field/39.json delete mode 100644 tests/fixtures/mock_api/api/field/40.json delete mode 100644 tests/fixtures/mock_api/api/field/41.json delete mode 100644 tests/fixtures/mock_api/api/field/42.json delete mode 100644 tests/fixtures/mock_api/api/field/43.json delete mode 100644 tests/fixtures/mock_api/api/field/44.json delete mode 100644 tests/fixtures/mock_api/api/field/45.json delete mode 100644 tests/fixtures/mock_api/api/field/46.json delete mode 100644 tests/fixtures/mock_api/api/field/47.json delete mode 100644 tests/fixtures/mock_api/api/field/48.json delete mode 100644 tests/fixtures/mock_api/api/field/49.json delete mode 100644 tests/fixtures/mock_api/api/field/50.json delete mode 100644 tests/fixtures/mock_api/api/field/51.json delete mode 100644 tests/fixtures/mock_api/api/field/52.json delete mode 100644 tests/fixtures/mock_api/api/field/53.json delete mode 100644 tests/fixtures/mock_api/api/field/54.json delete mode 100644 tests/fixtures/mock_api/api/field/55.json delete mode 100644 tests/fixtures/mock_api/api/field/56.json delete mode 100644 tests/fixtures/mock_api/api/field/57.json delete mode 100644 tests/fixtures/mock_api/api/field/58.json delete mode 100644 tests/fixtures/mock_api/api/field/59.json delete mode 100644 tests/fixtures/mock_api/api/field/60.json delete mode 100644 tests/fixtures/mock_api/api/field/61.json delete mode 100644 tests/fixtures/mock_api/api/field/62.json delete mode 100644 tests/fixtures/mock_api/api/field/63.json delete mode 100644 tests/fixtures/mock_api/api/field/64.json delete mode 100644 tests/fixtures/mock_api/api/field/65.json delete mode 100644 tests/fixtures/mock_api/api/field/66.json delete mode 100644 tests/fixtures/mock_api/api/field/67.json delete mode 100644 tests/fixtures/mock_api/api/field/68.json delete mode 100644 tests/fixtures/mock_api/api/field/69.json delete mode 100644 tests/fixtures/mock_api/api/field/70.json delete mode 100644 tests/fixtures/mock_api/api/field/71.json delete mode 100644 tests/fixtures/mock_api/api/field/72.json delete mode 100644 tests/fixtures/mock_api/api/field/73.json delete mode 100644 tests/fixtures/mock_api/api/field/74.json delete mode 100644 tests/fixtures/mock_api/api/table.json delete mode 100644 tests/fixtures/mock_api/api/table/10.json delete mode 100644 tests/fixtures/mock_api/api/table/11.json delete mode 100644 tests/fixtures/mock_api/api/table/12.json delete mode 100644 tests/fixtures/mock_api/api/table/5.json delete mode 100644 tests/fixtures/mock_api/api/table/6.json delete mode 100644 tests/fixtures/mock_api/api/table/7.json delete mode 100644 tests/fixtures/mock_api/api/table/8.json delete mode 100644 tests/fixtures/mock_api/api/table/9.json delete mode 100644 tests/fixtures/mock_api/api/user.json delete mode 100644 tests/fixtures/mock_api/api/user/1.json create mode 100644 tests/test_core_exposures.py create mode 100644 tests/test_core_models.py delete mode 100644 tests/test_dbt.py create mode 100644 tests/test_manifest.py delete mode 100644 tests/test_metabase.py diff --git a/Makefile b/Makefile index c9e6771f..62c41f24 100644 --- a/Makefile +++ b/Makefile @@ -57,40 +57,40 @@ dist-upload: check twine upload dist/* .PHONY: dist-upload -dev-install: build +install: build python3 -m pip uninstall -y dbt-metabase \ && python3 -m pip install dist/dbt_metabase-*-py3-none-any.whl -.PHONY: dev-install +.PHONY: install -dev-sandbox-up: +sandbox-up: ( cd sandbox && docker-compose up --build --attach app ) -.PHONY: dev-sandbox-up +.PHONY: sandbox-up -dev-sandbox-down: +sandbox-down: ( cd sandbox && docker-compose down ) -.PHONY: dev-sandbox-up +.PHONY: sandbox-up -dev-sandbox-models: +sandbox-models: ( source sandbox/.env && python3 -m dbtmetabase models \ - --dbt-manifest-path sandbox/target/manifest.json \ - --dbt-database $$POSTGRES_DB \ + --manifest-path sandbox/target/manifest.json \ --metabase-url http://localhost:$$MB_PORT \ --metabase-username $$MB_USER \ --metabase-password $$MB_PASSWORD \ - --metabase-database $$POSTGRES_DB ) -.PHONY: dev-sandbox-models + --metabase-database $$POSTGRES_DB \ + --verbose ) +.PHONY: sandbox-models -dev-sandbox-exposures: +sandbox-exposures: rm -rf sandbox/models/exposures mkdir -p sandbox/models/exposures ( source sandbox/.env && python3 -m dbtmetabase exposures \ - --dbt-manifest-path sandbox/target/manifest.json \ - --dbt-database $$POSTGRES_DB \ + --manifest-path sandbox/target/manifest.json \ --metabase-url http://localhost:$$MB_PORT \ --metabase-username $$MB_USER \ --metabase-password $$MB_PASSWORD \ --output-path sandbox/models/exposures \ - --output-grouping collection ) + --output-grouping collection \ + --verbose ) ( source sandbox/.env && cd sandbox && \ POSTGRES_HOST=localhost \ @@ -100,7 +100,7 @@ dev-sandbox-exposures: POSTGRES_DB=$$POSTGRES_DB \ POSTGRES_SCHEMA=$$POSTGRES_SCHEMA \ dbt docs generate ) -.PHONY: dev-sandbox-exposures +.PHONY: sandbox-exposures -dev-sandbox-e2e: dev-sandbox-up dev-sandbox-models dev-sandbox-exposures dev-sandbox-down -.PHONY: dev-sandbox-e2e +sandbox-e2e: sandbox-up sandbox-models sandbox-exposures sandbox-down +.PHONY: sandbox-e2e diff --git a/dbtmetabase/__init__.py b/dbtmetabase/__init__.py index d9a1988b..a0a944a6 100644 --- a/dbtmetabase/__init__.py +++ b/dbtmetabase/__init__.py @@ -1,11 +1,12 @@ import logging -from .dbt import DbtReader -from .metabase import MetabaseClient +from .core import DbtMetabase +from .interface import Filter, MetabaseArgumentError, MetabaseRuntimeError -logger = logging.getLogger(__name__) - -__all__ = ["DbtReader", "MetabaseClient"] +__all__ = [ + "DbtMetabase", + "Filter", +] try: from ._version import __version__ as version # type: ignore diff --git a/dbtmetabase/__main__.py b/dbtmetabase/__main__.py index d6b526d5..4419f528 100644 --- a/dbtmetabase/__main__.py +++ b/dbtmetabase/__main__.py @@ -1,86 +1,17 @@ import functools import logging -from logging.handlers import RotatingFileHandler from pathlib import Path -from typing import Callable, Iterable, List, Optional, Union +from typing import Callable, Optional, Sequence import click import yaml -from rich.logging import RichHandler from typing_extensions import cast -from .dbt import DbtReader -from .metabase import MetabaseClient - -LOG_PATH = Path.home().absolute() / ".dbt-metabase" / "logs" / "dbtmetabase.log" - -logger = logging.getLogger(__name__) - - -def _setup_logger(level: int = logging.INFO): - """Basic logger configuration for the CLI. - - Args: - level (int, optional): Logging level. Defaults to logging.INFO. - """ - - LOG_PATH.parent.mkdir(parents=True, exist_ok=True) - file_handler = RotatingFileHandler( - filename=LOG_PATH, - maxBytes=int(1e6), - backupCount=3, - ) - file_handler.setFormatter( - logging.Formatter("%(asctime)s — %(name)s — %(levelname)s — %(message)s") - ) - file_handler.setLevel(logging.WARNING) - - rich_handler = RichHandler( - level=level, - rich_tracebacks=True, - markup=True, - show_time=False, - ) - - logging.basicConfig( - level=level, - format="%(asctime)s — %(message)s", - datefmt="%Y-%m-%d %H:%M:%S %z", - handlers=[file_handler, rich_handler], - force=True, - ) - - -def _comma_separated_list_callback( - ctx: click.Context, - param: click.Option, - value: Union[str, List[str]], -) -> Optional[List[str]]: - """Click callback for handling comma-separated lists.""" - - if value is None: - return None - - assert ( - param.type == click.UNPROCESSED or param.type.name == "list" - ), "comma-separated list options must be of type UNPROCESSED or list" - - if ctx.get_parameter_source(str(param.name)) in ( - click.core.ParameterSource.DEFAULT, - click.core.ParameterSource.DEFAULT_MAP, - ) and isinstance(value, list): - # Lists in defaults (config or option) should be lists - return value - - elif isinstance(value, str): - str_value = value - if isinstance(value, list): - # When type=list, string value will be a list of chars - str_value = "".join(value) - else: - raise click.BadParameter("must be comma-separated list") - - return str_value.split(",") +from ._format import click_list_option_kwargs, setup_logging +from .core import DbtMetabase +from .core_exposures import ExposuresExtractorMixin +from .core_model import ModelsExporterMixin +from .interface import Filter @click.group() @@ -105,68 +36,24 @@ def cli(ctx: click.Context, config_path: str): def _add_setup(func: Callable) -> Callable: - """Add common options and create DbtReader and MetabaseClient.""" + """Add common options and initialize core.""" @click.option( - "--dbt-manifest-path", - envvar="DBT_MANIFEST_PATH", + "--manifest-path", + envvar="MANIFEST_PATH", show_envvar=True, required=True, type=click.Path(exists=True, dir_okay=False), - help="Path to dbt manifest.json file under /target/ in the dbt project directory. Uses dbt manifest parsing (recommended).", - ) - @click.option( - "--dbt-database", - metavar="DATABASE", - envvar="DBT_DATABASE", - show_envvar=True, - required=True, - type=click.STRING, - help="Target database name in dbt models.", - ) - @click.option( - "--dbt-schema", - metavar="SCHEMA", - envvar="DBT_SCHEMA", - show_envvar=True, - help="Target dbt schema. Must be passed if using project reader.", - type=click.STRING, - ) - @click.option( - "--dbt-schema-excludes", - metavar="SCHEMAS", - envvar="DBT_SCHEMA_EXCLUDES", - show_envvar=True, - type=click.UNPROCESSED, - callback=_comma_separated_list_callback, - help="Target dbt schemas to exclude. Ignored in project parser.", - ) - @click.option( - "--dbt-includes", - metavar="MODELS", - envvar="DBT_INCLUDES", - show_envvar=True, - type=click.UNPROCESSED, - callback=_comma_separated_list_callback, - help="Include specific dbt models names.", - ) - @click.option( - "--dbt-excludes", - metavar="MODELS", - envvar="DBT_EXCLUDES", - show_envvar=True, - type=click.UNPROCESSED, - callback=_comma_separated_list_callback, - help="Exclude specific dbt model names.", + help="Path to dbt manifest.json, usually in target/ directory after compilation.", ) @click.option( "--metabase-url", metavar="URL", - envvar="MB_URL", + envvar="METABASE_URL", show_envvar=True, required=True, type=click.STRING, - help="Metabase URL, including protocol and excluding trailing slash.", + help="Metabase URL, e.g. 'https://metabase.example.com'.", ) @click.option( "--metabase-username", @@ -174,7 +61,7 @@ def _add_setup(func: Callable) -> Callable: envvar="METABASE_USERNAME", show_envvar=True, type=click.STRING, - help="Metabase username.", + help="Metabase username (required unless providing session ID).", ) @click.option( "--metabase-password", @@ -182,7 +69,7 @@ def _add_setup(func: Callable) -> Callable: envvar="METABASE_PASSWORD", show_envvar=True, type=click.STRING, - help="Metabase password.", + help="Metabase password (required unless providing session ID).", ) @click.option( "--metabase-session-id", @@ -190,33 +77,31 @@ def _add_setup(func: Callable) -> Callable: envvar="METABASE_SESSION_ID", show_envvar=True, type=click.STRING, - help="Metabase session ID.", + help="Metabase session ID (alternative to username/password).", ) @click.option( - "--metabase-verify/--metabase-verify-skip", - "metabase_verify", - envvar="METABASE_VERIFY", + "--skip-verify", + envvar="SKIP_VERIFY", show_envvar=True, - default=True, - help="Verify the TLS certificate at the Metabase end.", + help="Skip TLS certificate verification (not recommended).", ) @click.option( - "--metabase-cert", + "--cert", metavar="CERT", - envvar="METABASE_CERT", + envvar="CERT", show_envvar=True, type=click.Path(exists=True, dir_okay=False), - help="Path to certificate bundle used to connect to Metabase.", + help="Path to TLS certificate bundle.", ) @click.option( - "--metabase-timeout", + "--http-timeout", metavar="SECS", - envvar="METABASE_TIMEOUT", + envvar="HTTP_TIMEOUT", show_envvar=True, type=click.INT, - default=15, + default=DbtMetabase.DEFAULT_HTTP_TIMEOUT, show_default=True, - help="Metabase API HTTP timeout in seconds.", + help="HTTP timeout in seconds.", ) @click.option( "-v", @@ -226,41 +111,32 @@ def _add_setup(func: Callable) -> Callable: ) @functools.wraps(func) def wrapper( + manifest_path: str, metabase_url: str, metabase_username: str, metabase_password: str, - dbt_database: str, - dbt_manifest_path: str, - dbt_schema: Optional[str], - dbt_schema_excludes: Optional[Iterable], - dbt_includes: Optional[Iterable], - dbt_excludes: Optional[Iterable], metabase_session_id: Optional[str], - metabase_verify: bool, - metabase_cert: Optional[str], - metabase_timeout: int, + skip_verify: bool, + cert: Optional[str], + http_timeout: int, verbose: bool, **kwargs, ): - _setup_logger(level=logging.DEBUG if verbose else logging.INFO) + setup_logging( + level=logging.DEBUG if verbose else logging.INFO, + path=Path.home().absolute() / ".dbt-metabase" / "logs" / "dbtmetabase.log", + ) return func( - dbt_reader=DbtReader( - manifest_path=dbt_manifest_path, - database=dbt_database, - schema=dbt_schema, - schema_excludes=dbt_schema_excludes, - includes=dbt_includes, - excludes=dbt_excludes, - ), - metabase_client=MetabaseClient( - url=metabase_url, - username=metabase_username, - password=metabase_password, - session_id=metabase_session_id, - verify=metabase_verify, - cert=metabase_cert, - http_timeout=metabase_timeout, + core=DbtMetabase( + manifest_path=manifest_path, + metabase_url=metabase_url, + metabase_username=metabase_username, + metabase_password=metabase_password, + metabase_session_id=metabase_session_id, + skip_verify=skip_verify, + cert=cert, + http_timeout=http_timeout, ), **kwargs, ) @@ -271,126 +147,176 @@ def wrapper( @cli.command(help="Export dbt models to Metabase.") @_add_setup @click.option( - "--dbt-docs-url", - metavar="URL", - envvar="DBT_DOCS_URL", + "--metabase-database", + metavar="METABASE_DATABASE", + envvar="METABASE_DATABASE", show_envvar=True, + required=True, type=click.STRING, - help="URL for dbt docs to be appended to table descriptions in Metabase.", + help="Target database in Metabase.", ) @click.option( - "--dbt-include-tags", - envvar="DBT_INCLUDE_TAGS", + "--include-databases", + metavar="DATABASES", + envvar="INCLUDE_DATABASES", show_envvar=True, - is_flag=True, - help="Append tags to table descriptions in Metabase.", + **click_list_option_kwargs(), + help="Only include certain dbt databases.", ) @click.option( - "--metabase-database", - metavar="DATABASE", - envvar="METABASE_DATABASE", + "--exclude-databases", + metavar="DATABASES", + envvar="EXCLUDE_DATABASES", show_envvar=True, - required=True, - type=click.STRING, - help="Target database name in Metabase.", + **click_list_option_kwargs(), + help="Exclude certain dbt databases.", ) @click.option( - "--metabase-sync-timeout", + "--include-schemas", + metavar="SCHEMAS", + envvar="INCLUDE_SCHEMAS", + show_envvar=True, + **click_list_option_kwargs(), + help="Only include certain dbt schemas.", +) +@click.option( + "--exclude-schemas", + metavar="SCHEMAS", + envvar="EXCLUDE_SCHEMAS", + show_envvar=True, + **click_list_option_kwargs(), + help="Exclude certain dbt schemas.", +) +@click.option( + "--include-models", + metavar="MODELS", + envvar="INCLUDE_MODELS", + show_envvar=True, + **click_list_option_kwargs(), + help="Only include certain dbt models.", +) +@click.option( + "--exclude-models", + metavar="MODELS", + envvar="EXCLUDE_MODELS", + show_envvar=True, + **click_list_option_kwargs(), + help="Exclude certain dbt models.", +) +@click.option( + "--sync-timeout", metavar="SECS", - envvar="METABASE_SYNC_TIMEOUT", + envvar="SYNC_TIMEOUT", show_envvar=True, - default=30, + default=ModelsExporterMixin.DEFAULT_SYNC_TIMEOUT, type=click.INT, - help="Synchronization timeout in secs. When set, command fails on failed synchronization. Otherwise, command proceeds regardless. Only valid if sync is enabled.", + help="Number of seconds to wait until Metabase schema matches the dbt project. To skip synchronization, set timeout to 0.", ) @click.option( - "--metabase-exclude-sources", - envvar="METABASE_EXCLUDE_SOURCES", + "--skip-sources", + envvar="SKIP_SOURCES", show_envvar=True, is_flag=True, - help="Skip exporting sources to Metabase.", + help="Exclude dbt sources from export.", +) +@click.option( + "--append-tags", + envvar="APPEND_TAGS", + show_envvar=True, + is_flag=True, + help="Append dbt tags to table descriptions.", +) +@click.option( + "--docs-url", + metavar="URL", + envvar="DOCS_URL", + show_envvar=True, + type=click.STRING, + help="URL for dbt docs hosting, to append model links to table descriptions.", ) def models( - dbt_docs_url: Optional[str], - dbt_include_tags: bool, metabase_database: str, - metabase_sync_timeout: int, - metabase_exclude_sources: bool, - dbt_reader: DbtReader, - metabase_client: MetabaseClient, + include_databases: Optional[Sequence[str]], + exclude_databases: Optional[Sequence[str]], + include_schemas: Optional[Sequence[str]], + exclude_schemas: Optional[Sequence[str]], + include_models: Optional[Sequence[str]], + exclude_models: Optional[Sequence[str]], + skip_sources: bool, + sync_timeout: int, + append_tags: bool, + docs_url: Optional[str], + core: DbtMetabase, ): - dbt_models = dbt_reader.read_models( - include_tags=dbt_include_tags, - docs_url=dbt_docs_url, - ) - metabase_client.export_models( - database=metabase_database, - models=dbt_models, - exclude_sources=metabase_exclude_sources, - sync_timeout=metabase_sync_timeout, + core.export_models( + metabase_database=metabase_database, + database_filter=Filter(include=include_databases, exclude=exclude_databases), + schema_filter=Filter(include=include_schemas, exclude=exclude_schemas), + model_filter=Filter(include=include_models, exclude=exclude_models), + skip_sources=skip_sources, + sync_timeout=sync_timeout, + append_tags=append_tags, + docs_url=docs_url, ) -@cli.command(help="Export dbt exposures to Metabase.") +@cli.command(help="Extract dbt exposures from Metabase.") @_add_setup @click.option( "--output-path", envvar="OUTPUT_PATH", show_envvar=True, type=click.Path(exists=True, file_okay=False), - default=".", + default=ExposuresExtractorMixin.DEFAULT_OUTPUT_PATH, show_default=True, - help="Output path for generated exposure YAML files.", + help="Output path for exposure YAML files.", ) @click.option( "--output-grouping", envvar="OUTPUT_GROUPING", show_envvar=True, type=click.Choice(["collection", "type"]), - help="Grouping for output YAML files", + help="Grouping key for exposure YAML files.", ) @click.option( - "--metabase-include-personal-collections", - envvar="METABASE_INCLUDE_PERSONAL_COLLECTIONS", + "--include-collections", + metavar="COLLECTIONS", + envvar="INCLUDE_COLLECTIONS", show_envvar=True, - is_flag=True, - help="Include personal collections when parsing exposures.", + **click_list_option_kwargs(), + help="Only include certain Metabase collections.", ) @click.option( - "--metabase-collection-includes", + "--exclude-collections", metavar="COLLECTIONS", - envvar="METABASE_COLLECTION_INCLUDES", + envvar="EXCLUDE_COLLECTIONS", show_envvar=True, - type=click.UNPROCESSED, - callback=_comma_separated_list_callback, - help="Metabase collection names to includes.", + **click_list_option_kwargs(), + help="Exclude certain Metabase collections.", ) @click.option( - "--metabase-collection-excludes", - metavar="COLLECTIONS", - envvar="METABASE_COLLECTION_EXCLUDES", + "--allow-personal-collections", + envvar="ALLOW_PERSONAL_COLLECTIONS", show_envvar=True, - type=click.UNPROCESSED, - callback=_comma_separated_list_callback, - help="Metabase collection names to exclude.", + is_flag=True, + help="Include personal Metabase collections.", ) def exposures( output_path: str, output_grouping: Optional[str], - metabase_include_personal_collections: bool, - metabase_collection_includes: Optional[Iterable], - metabase_collection_excludes: Optional[Iterable], - dbt_reader: DbtReader, - metabase_client: MetabaseClient, + include_collections: Optional[Sequence[str]], + exclude_collections: Optional[Sequence[str]], + allow_personal_collections: bool, + core: DbtMetabase, ): - dbt_models = dbt_reader.read_models() - metabase_client.extract_exposures( - models=dbt_models, + core.extract_exposures( output_path=output_path, output_grouping=output_grouping, - include_personal_collections=metabase_include_personal_collections, - collection_includes=metabase_collection_includes, - collection_excludes=metabase_collection_excludes, + collection_filter=Filter( + include=include_collections, + exclude=exclude_collections, + ), + allow_personal_collections=allow_personal_collections, ) diff --git a/dbtmetabase/_format.py b/dbtmetabase/_format.py index 22dea718..2cef0d95 100644 --- a/dbtmetabase/_format.py +++ b/dbtmetabase/_format.py @@ -1,5 +1,104 @@ +from __future__ import annotations + +import logging import re -from typing import Optional +from logging.handlers import RotatingFileHandler +from pathlib import Path +from typing import Any, Iterable, List, Mapping, MutableSequence, Optional, Union + +import click +from rich.logging import RichHandler + + +class _NullValue(str): + """Explicitly null field value.""" + + def __eq__(self, other: object) -> bool: + return other is None + + +NullValue = _NullValue() + + +def setup_logging(level: int, path: Optional[Path] = None): + """Basic logger configuration for the CLI. + + Args: + level (int): Logging level. Defaults to logging.INFO. + path (Path): Path to file logs. + """ + + handlers: MutableSequence[logging.Handler] = [] + + if path: + path.parent.mkdir(parents=True, exist_ok=True) + file_handler = RotatingFileHandler( + filename=path, + maxBytes=int(1e6), + backupCount=3, + ) + file_handler.setFormatter( + logging.Formatter("%(asctime)s — %(name)s — %(levelname)s — %(message)s") + ) + file_handler.setLevel(logging.WARNING) + handlers.append(file_handler) + + handlers.append( + RichHandler( + level=level, + rich_tracebacks=True, + markup=True, + show_time=False, + ) + ) + + logging.basicConfig( + level=level, + format="%(asctime)s — %(message)s", + datefmt="%Y-%m-%d %H:%M:%S %z", + handlers=handlers, + force=True, + ) + + +def click_list_option_kwargs() -> Mapping[str, Any]: + """Click option that accepts comma-separated values. + + Built-in list only allows repeated flags, which is ugly for larger lists. + + Returns: + Mapping[str, Any]: Mapping of kwargs (to be unpacked with **). + """ + + def callback( + ctx: click.Context, + param: click.Option, + value: Union[str, List[str]], + ) -> Optional[List[str]]: + if value is None: + return None + + if ctx.get_parameter_source(str(param.name)) in ( + click.core.ParameterSource.DEFAULT, + click.core.ParameterSource.DEFAULT_MAP, + ) and isinstance(value, list): + # Lists in defaults (config or option) should be lists + return value + + elif isinstance(value, str): + str_value = value + if isinstance(value, list): + # When type=list, string value will be a list of chars + str_value = "".join(value) + else: + raise click.BadParameter("must be comma-separated list") + + return str_value.split(",") + + return { + "type": click.UNPROCESSED, + "callback": callback, + } def safe_name(text: Optional[str]) -> str: @@ -26,3 +125,23 @@ def safe_description(text: Optional[str]) -> str: str: Sanitized string with escaped Jinja syntax. """ return re.sub(r"{{(.*)}}", r"\1", text or "") + + +def scan_fields(t: Mapping, fields: Iterable[str], ns: str) -> Mapping: + """Reads meta fields from a schem object. + + Args: + t (Mapping): Target to scan for fields. + fields (List): List of fields to accept. + ns (str): Field namespace (separated by .). + + Returns: + Mapping: Field values. + """ + + vals = {} + for field in fields: + if f"{ns}.{field}" in t: + value = t[f"{ns}.{field}"] + vals[field] = value if value is not None else NullValue + return vals diff --git a/dbtmetabase/core.py b/dbtmetabase/core.py new file mode 100644 index 00000000..bfed2b96 --- /dev/null +++ b/dbtmetabase/core.py @@ -0,0 +1,133 @@ +from __future__ import annotations + +import logging +from pathlib import Path +from typing import Any, Dict, Iterable, Mapping, Optional, Tuple, Union + +import requests +from requests.adapters import HTTPAdapter, Retry + +from .core_exposures import ExposuresExtractorMixin +from .core_model import ModelsExporterMixin +from .interface import MetabaseArgumentError +from .manifest import Manifest, Model + +_logger = logging.getLogger(__name__) + + +class DbtMetabase(ModelsExporterMixin, ExposuresExtractorMixin): + """dbt + Metabase integration.""" + + DEFAULT_HTTP_TIMEOUT = 15 + + def __init__( + self, + manifest_path: Union[str, Path], + metabase_url: str, + metabase_username: Optional[str] = None, + metabase_password: Optional[str] = None, + metabase_session_id: Optional[str] = None, + skip_verify: bool = False, + cert: Optional[Union[str, Tuple[str, str]]] = None, + http_timeout: int = DEFAULT_HTTP_TIMEOUT, + http_headers: Optional[dict] = None, + http_adapter: Optional[HTTPAdapter] = None, + ): + """ + Args: + manifest_path (Union[str,Path]): Path to dbt manifest.json, usually in target/ directory after compilation. + metabase_url (str): Metabase URL, e.g. "https://metabase.example.com". + metabase_username (Optional[str], optional): Metabase username (required unless providing session ID). Defaults to None. + metabase_password (Optional[str], optional): Metabase password (required unless providing session ID). Defaults to None. + metabase_session_id (Optional[str], optional): Metabase session ID. Defaults to None. + skip_verify (bool, optional): Skip TLS certificate verification (not recommended). Defaults to False. + cert (Optional[Union[str, Tuple[str, str]]], optional): Path to a custom certificate. Defaults to None. + http_timeout (int, optional): HTTP request timeout in secs. Defaults to 15. + http_headers (Optional[dict], optional): Additional HTTP headers. Defaults to None. + http_adapter (Optional[HTTPAdapter], optional): Custom requests HTTP adapter. Defaults to None. + """ + + self.manifest_reader = Manifest(path=manifest_path) + + self.metabase_url = metabase_url.rstrip("/") + + self.http_timeout = http_timeout + + self.session = requests.Session() + self.session.verify = not skip_verify + self.session.cert = cert + + if http_headers: + self.session.headers.update(http_headers) + + self.session.mount( + self.metabase_url, + http_adapter or HTTPAdapter(max_retries=Retry(total=3, backoff_factor=1)), + ) + + if not metabase_session_id: + if metabase_username and metabase_password: + session = self.metabase_api( + method="post", + path="/api/session", + json={"username": metabase_username, "password": metabase_password}, + ) + metabase_session_id = str(session["id"]) + else: + raise MetabaseArgumentError("Credentials or session ID required") + self.session.headers["X-Metabase-Session"] = metabase_session_id + + _logger.info("Metabase session established") + + def read_models(self) -> Iterable[Model]: + return self.manifest_reader.read_models() + + def metabase_api( + self, + method: str, + path: str, + params: Optional[Dict[str, Any]] = None, + critical: bool = True, + **kwargs, + ) -> Mapping: + """Unified way of calling Metabase API. + + Args: + method (str): HTTP verb, e.g. get, post, put. + path (str): Relative path of endpoint, e.g. /api/database. + critical (bool, optional): Raise on any HTTP errors. Defaults to True. + + Returns: + Mapping: JSON payload of the endpoint. + """ + + if params: + for key, value in params.items(): + if isinstance(value, bool): + params[key] = str(value).lower() + + response = self.session.request( + method=method, + url=f"{self.metabase_url}{path}", + params=params, + timeout=self.http_timeout, + **kwargs, + ) + + try: + response.raise_for_status() + except requests.exceptions.HTTPError: + if critical: + _logger.error("HTTP request failed: %s", response.text) + raise + return {} + + response_json = response.json() + if "data" in response_json: + # Since X.40.0 responses are encapsulated in "data" with pagination parameters + return response_json["data"] + + return response_json + + def format_metabase_url(self, path: str) -> str: + return self.metabase_url + path diff --git a/dbtmetabase/core_exposures.py b/dbtmetabase/core_exposures.py new file mode 100644 index 00000000..5bcbbd8a --- /dev/null +++ b/dbtmetabase/core_exposures.py @@ -0,0 +1,463 @@ +from __future__ import annotations + +import logging +import re +from abc import ABCMeta, abstractmethod +from operator import itemgetter +from pathlib import Path +from typing import Iterable, Mapping, MutableMapping, MutableSequence, Optional, Tuple + +import requests +import yaml + +from ._format import safe_description, safe_name +from .interface import Filter, MetabaseArgumentError +from .manifest import Model + +_RESOURCE_VERSION = 2 + +# Extracting table in `from` and `join` clauses (won't recognize some valid SQL, e.g. `from "table with spaces"`) +_EXPOSURE_PARSER = re.compile(r"[FfJj][RrOo][OoIi][MmNn]\s+([\w.\"]+)") +_CTE_PARSER = re.compile( + r"[Ww][Ii][Tt][Hh]\s+\b(\w+)\b\s+as|[)]\s*[,]\s*\b(\w+)\b\s+as" +) + +_logger = logging.getLogger(__name__) + + +class ExposuresExtractorMixin(metaclass=ABCMeta): + """Abstraction for extracting exposures.""" + + DEFAULT_OUTPUT_PATH = "." + + @abstractmethod + def read_models(self) -> Iterable[Model]: + pass + + @abstractmethod + def metabase_api(self, method: str, path: str, **kwargs) -> Mapping: + pass + + @abstractmethod + def format_metabase_url(self, path: str) -> str: + pass + + def extract_exposures( + self, + output_path: str = DEFAULT_OUTPUT_PATH, + output_grouping: Optional[str] = None, + collection_filter: Optional[Filter] = None, + allow_personal_collections: bool = False, + ) -> Iterable[Mapping]: + """Extract dbt exposures from Metabase. + + Args: + output_path (str, optional): Path for output files. Defaults to ".". + output_grouping (Optional[str], optional): Grouping for output YAML files, supported values: "collection" (by collection slug) or "type" (by entity type). Defaults to None. + collection_filter (Optional[Filter], optional): Filter Metabase collections. Defaults to None. + allow_personal_collections (bool, optional): Allow personal Metabase collections. Defaults to False. + + Returns: + Iterable[Mapping]: List of parsed exposures. + """ + + if output_grouping not in (None, "collection", "type"): + raise MetabaseArgumentError( + f"Unsupported output_grouping: {output_grouping}" + ) + + models = self.read_models() + + ctx = _Context( + model_refs={m.name.upper(): m.ref for m in models if m.ref}, + table_names={ + t["id"]: t["name"] for t in self.metabase_api("get", "/api/table") + }, + ) + + exposures = [] + exposure_counts: MutableMapping[str, int] = {} + + for collection in self.metabase_api( + method="get", + path="/api/collection", + params={"exclude-other-user-collections": not allow_personal_collections}, + ): + name = collection["name"] + is_personal = collection.get("personal_owner_id", False) + + name_selected = not collection_filter or collection_filter.selected(name) + personal_skipped = not allow_personal_collections and is_personal + if not name_selected or personal_skipped: + _logger.debug("Skipping collection %s", collection["name"]) + continue + + _logger.info("Exploring collection: %s", collection["name"]) + expected_models = ["card", "dashboard"] + for item in self.metabase_api( + method="get", + path=f"/api/collection/{collection['id']}/items", + params={"models": expected_models}, + ): + # Ensure collection item is of parsable type + exposure_type = item["model"] + exposure_id = item["id"] + if exposure_type not in expected_models: + continue + + # Prepare attributes for population through _extract_card_exposures calls + ctx.models_exposed = [] + ctx.native_query = "" + native_query = "" + + exposure = self.metabase_api( + "get", f"/api/{exposure_type}/{exposure_id}" + ) + exposure_name = exposure.get("name", "Exposure [Unresolved Name]") + _logger.info("Introspecting exposure: %s", exposure_name) + + header = None + creator_name = None + creator_email = None + + # Process exposure + if exposure_type == "card": + # Build header for card and extract models to self.models_exposed + header = "### Visualization: {}\n\n".format( + exposure.get("display", "Unknown").title() + ) + + # Parse Metabase question + self.__extract_card_exposures(ctx, exposure_id, exposure) + native_query = ctx.native_query + + elif exposure_type == "dashboard": + # We expect this dict key in order to iter through questions + cards = exposure.get("ordered_cards", []) + if not cards: + continue + + # Build header for dashboard and extract models for each question to self.models_exposed + header = f"### Dashboard Cards: {len(cards)}\n\n" + + # Iterate through dashboard questions + for dashboard_item in cards: + dashboard_item_reference = dashboard_item.get("card", {}) + if "id" not in dashboard_item_reference: + continue + + # Parse Metabase question + self.__extract_card_exposures( + ctx, dashboard_item_reference["id"] + ) + + if not ctx.models_exposed: + _logger.info("No models mapped to exposure") + + # Extract creator info + if "creator" in exposure: + creator_email = exposure["creator"]["email"] + creator_name = exposure["creator"]["common_name"] + elif "creator_id" in exposure: + try: + creator = self.metabase_api( + "get", f"/api/user/{exposure['creator_id']}" + ) + except requests.exceptions.HTTPError as error: + # If a Metabase user is deactivated, the API returns a 404 + creator = {} + if error.response is None or error.response.status_code != 404: + raise + + creator_name = creator.get("common_name") + creator_email = creator.get("email") + + exposure_label = exposure_name + # Unique names with letters, numbers and underscores allowed in dbt docs DAG + exposure_name = safe_name(exposure_name) + exposure_count = exposure_counts.get(exposure_name, 0) + exposure_counts[exposure_name] = exposure_count + 1 + exposure_suffix = f"_{exposure_count}" if exposure_count > 0 else "" + + exposures.append( + { + "id": item["id"], + "type": item["model"], + "collection": collection, + "body": self.__build_exposure( + ctx, + exposure_type=exposure_type, + exposure_id=exposure_id, + name=exposure_name + exposure_suffix, + label=exposure_label, + header=header or "", + created_at=exposure["created_at"], + creator_name=creator_name or "", + creator_email=creator_email or "", + description=exposure.get("description", ""), + native_query=native_query, + ), + } + ) + + self.__write_exposures(exposures, output_path, output_grouping) + + return exposures + + def __extract_card_exposures( + self, + ctx: _Context, + card_id: int, + exposure: Optional[Mapping] = None, + ): + """Extracts exposures from Metabase questions populating `ctx.models_exposed` + + Arguments: + card_id {int} -- Metabase question ID used to pull question from API. + + Keyword Arguments: + exposure {str} -- API response from a question in Metabase, allows us to use the object if already in memory. + + Returns: + None -- ctx.models_exposed is populated through this method. + """ + + # If an exposure is not passed, pull from id + if not exposure: + exposure = self.metabase_api("get", f"/api/card/{card_id}") + + query = exposure.get("dataset_query", {}) + + if query.get("type") == "query": + # Metabase GUI derived query + source_table_id = query.get("query", {}).get( + "source-table", exposure.get("table_id") + ) + + if str(source_table_id).startswith("card__"): + # Handle questions based on other question in virtual db + self.__extract_card_exposures( + ctx, + card_id=int(source_table_id.split("__")[-1]), + ) + else: + # Normal question + source_table = ctx.table_names.get(source_table_id) + if source_table: + _logger.info( + "Model extracted from Metabase question: %s", + source_table, + ) + ctx.models_exposed.append(source_table) + + # Find models exposed through joins + for query_join in query.get("query", {}).get("joins", []): + # Handle questions based on other question in virtual db + if str(query_join.get("source-table", "")).startswith("card__"): + self.__extract_card_exposures( + ctx, + card_id=int(query_join.get("source-table").split("__")[-1]), + ) + continue + + # Joined model parsed + joined_table = ctx.table_names.get(query_join.get("source-table")) + if joined_table: + _logger.info( + "Model extracted from Metabase question join: %s", + joined_table, + ) + ctx.models_exposed.append(joined_table) + + elif query.get("type") == "native": + # Metabase native query + native_query = query["native"].get("query") + ctes: MutableSequence[str] = [] + + # Parse common table expressions for exclusion + for matched_cte in re.findall(_CTE_PARSER, native_query): + ctes.extend(group.upper() for group in matched_cte if group) + + # Parse SQL for exposures through FROM or JOIN clauses + for sql_ref in re.findall(_EXPOSURE_PARSER, native_query): + # Grab just the table / model name + clean_exposure = sql_ref.split(".")[-1].strip('"').upper() + + # Scrub CTEs (qualified sql_refs can not reference CTEs) + if clean_exposure in ctes and "." not in sql_ref: + continue + # Verify this is one of our parsed refable models so exposures dont break the DAG + if not ctx.model_refs.get(clean_exposure): + continue + + if clean_exposure: + _logger.info( + "Model extracted from native query: %s", + clean_exposure, + ) + ctx.models_exposed.append(clean_exposure) + ctx.native_query = native_query + + def __build_exposure( + self, + ctx: _Context, + exposure_type: str, + exposure_id: int, + name: str, + label: str, + header: str, + created_at: str, + creator_name: str, + creator_email: str, + description: str = "", + native_query: str = "", + ) -> Mapping: + """Builds an exposure object representation as defined here: https://docs.getdbt.com/reference/exposure-properties + + Arguments: + exposure_type {str} -- Model type in Metabase being either `card` or `dashboard` + exposure_id {str} -- Card or Dashboard id in Metabase + name {str} -- Name of exposure + label {str} -- Title of the card or dashboard in Metabase + header {str} -- The header goes at the top of the description and is useful for prefixing metadata + created_at {str} -- Timestamp of exposure creation derived from Metabase + creator_name {str} -- Creator name derived from Metabase + creator_email {str} -- Creator email derived from Metabase + + Keyword Arguments: + description {str} -- The description of the exposure as documented in Metabase. (default: No description provided in Metabase) + native_query {str} -- If exposure contains SQL, this arg will include the SQL in the dbt exposure documentation. (default: {""}) + + Returns: + Mapping -- JSON object representation of single exposure. + """ + + # Ensure model type is compatible + assert exposure_type in ( + "card", + "dashboard", + ), "Cannot construct exposure for object type of {}".format(exposure_type) + + if native_query: + # Format query into markdown code block + native_query = "#### Query\n\n```\n{}\n```\n\n".format( + "\n".join( + sql_line + for sql_line in ctx.native_query.strip().split("\n") + if sql_line.strip() != "" + ) + ) + + if not description: + description = "No description provided in Metabase\n\n" + + # Format metadata as markdown + metadata = ( + "#### Metadata\n\n" + + "Metabase Id: __{}__\n\n".format(exposure_id) + + "Created On: __{}__".format(created_at) + ) + + # Build description + description = ( + header + ("{}\n\n".format(description.strip())) + native_query + metadata + ) + + # Output exposure + return { + "name": name, + "label": label, + "description": safe_description(description), + "type": "analysis" if exposure_type == "card" else "dashboard", + "url": self.format_metabase_url(f"/{exposure_type}/{exposure_id}"), + "maturity": "medium", + "owner": { + "name": creator_name, + "email": creator_email, + }, + "depends_on": list( + { + ctx.model_refs[exposure.upper()] + for exposure in list({m for m in ctx.models_exposed}) + if exposure.upper() in ctx.model_refs + } + ), + } + + def __write_exposures( + self, + exposures: Iterable[Mapping], + output_path: str, + output_grouping: Optional[str], + ): + """Write exposures to output files. + + Args: + output_path (str): Path for output files. + exposures (Iterable[Mapping]): Collection of exposures. + """ + + for group, exp in self.__group_exposures(exposures, output_grouping).items(): + path = Path(output_path).expanduser() + path = path.joinpath(*group[:-1]) / f"{group[-1]}.yml" + path.parent.mkdir(parents=True, exist_ok=True) + + exposures_unwrapped = map(lambda x: x["body"], exp) + exposures_sorted = sorted(exposures_unwrapped, key=itemgetter("name")) + + with open(path, "w", encoding="utf-8") as f: + yaml.dump( + { + "version": _RESOURCE_VERSION, + "exposures": exposures_sorted, + }, + f, + Dumper=_YAMLDumper, + default_flow_style=False, + allow_unicode=True, + sort_keys=False, + ) + + def __group_exposures( + self, + exposures: Iterable[Mapping], + output_grouping: Optional[str], + ) -> Mapping[Tuple[str, ...], Iterable[Mapping]]: + """Group exposures by configured output grouping. + + Args: + exposures (Iterable[Mapping]): Collection of exposures. + + Returns: + Mapping[Tuple[str, ...], Iterable[Mapping]]: Exposures indexed by configured grouping. + """ + + results: MutableMapping[Tuple[str, ...], MutableSequence[Mapping]] = {} + + for exposure in exposures: + group: Tuple[str, ...] = ("exposures",) + if output_grouping == "collection": + collection = exposure["collection"] + group = (collection.get("slug") or safe_name(collection["name"]),) + elif output_grouping == "type": + group = (exposure["type"], exposure["id"]) + + result = results.get(group, []) + result.append(exposure) + if group not in results: + results[group] = result + + return results + + +class _Context: + def __init__(self, model_refs: Mapping[str, str], table_names: Mapping[str, str]): + self.model_refs = model_refs + self.table_names = table_names + self.models_exposed: MutableSequence[str] = [] + self.native_query = "" + + +class _YAMLDumper(yaml.Dumper): + def increase_indent(self, flow=False, indentless=False): + return super().increase_indent(flow, indentless=False) diff --git a/dbtmetabase/core_model.py b/dbtmetabase/core_model.py new file mode 100644 index 00000000..63452f4c --- /dev/null +++ b/dbtmetabase/core_model.py @@ -0,0 +1,419 @@ +from __future__ import annotations + +import logging +import time +from abc import ABCMeta, abstractmethod +from typing import Any, Iterable, Mapping, MutableMapping, Optional + +from ._format import NullValue, safe_name +from .interface import Filter, MetabaseRuntimeError +from .manifest import DEFAULT_SCHEMA, Column, Group, Model + +logger = logging.getLogger(__name__) + + +class ModelsExporterMixin(metaclass=ABCMeta): + """Abstraction for exporting models.""" + + __SYNC_PERIOD = 5 + + DEFAULT_SYNC_TIMEOUT = 30 + + @abstractmethod + def read_models(self) -> Iterable[Model]: + pass + + @abstractmethod + def metabase_api(self, method: str, path: str, **kwargs) -> Mapping: + pass + + def export_models( + self, + metabase_database: str, + database_filter: Optional[Filter] = None, + schema_filter: Optional[Filter] = None, + model_filter: Optional[Filter] = None, + skip_sources: bool = False, + sync_timeout: int = DEFAULT_SYNC_TIMEOUT, + append_tags: bool = False, + docs_url: Optional[str] = None, + ): + """Exports dbt models to Metabase database schema. + + Args: + metabase_database (str): Target database in Metabase. + database_filter (Optional[Filter], optional): Filter dbt manifest by database. Defaults to None. + schema_filter (Optional[Filter], optional): Filter dbt manifest by schema. Defaults to None. + model_filter (Optional[Filter], optional): Filter dbt manifest by model. Defaults to None. + skip_sources (bool, optional): Exclude dbt sources from export. Defaults to False. + sync_timeout (int, optional): Number of seconds to wait until Metabase schema matches the dbt project. To skip synchronization, set timeout to 0. Defaults to 30. + append_tags (bool, optional): Append dbt tags to table descriptions. Defaults to False. + docs_url (Optional[str], optional): URL for dbt docs hosting, to append model links to table descriptions. Defaults to None. + """ + + ctx = _Context() + success = True + + database_id = None + for api_database in self.metabase_api("get", "/api/database"): + if api_database["name"].upper() == metabase_database.upper(): + database_id = api_database["id"] + break + if not database_id: + raise MetabaseRuntimeError(f"Database {metabase_database} not found") + + models = self.__filtered_models( + models=self.read_models(), + database_filter=database_filter, + schema_filter=schema_filter, + model_filter=model_filter, + skip_sources=skip_sources, + ) + + self.metabase_api("post", f"/api/database/{database_id}/sync_schema") + + deadline = int(time.time()) + sync_timeout + synced = False + while not synced: + time.sleep(self.__SYNC_PERIOD) + + tables = self.__get_tables(database_id) + + synced = True + for model in models: + schema_name = model.schema.upper() + model_name = model.name.upper() + table_key = f"{schema_name}.{model_name}" + + table = tables.get(table_key) + if not table: + logger.warning( + "Model %s not found in %s schema", table_key, schema_name + ) + synced = False + continue + + for column in model.columns: + column_name = column.name.upper() + + field = table.get("fields", {}).get(column_name) + if not field: + logger.warning( + "Column %s not found in %s model", column_name, table_key + ) + synced = False + continue + + ctx.tables = tables + + if int(time.time()) > deadline: + break + + if not synced and sync_timeout: + raise MetabaseRuntimeError("Unable to sync models between dbt and Metabase") + + for model in models: + success &= self.__export_model(ctx, model, append_tags, docs_url) + + for update in ctx.updates.values(): + self.metabase_api( + method="put", + path=f"/api/{update['kind']}/{update['id']}", + json=update["body"], + ) + logger.info( + "API %s/%s updated successfully: %s", + update["kind"], + update["id"], + ", ".join(update.get("body", {}).keys()), + ) + + if not success: + raise MetabaseRuntimeError( + "Model export encountered non-critical errors, check output" + ) + + def __export_model( + self, + ctx: _Context, + model: Model, + append_tags: bool, + docs_url: Optional[str], + ) -> bool: + """Exports one dbt model to Metabase database schema.""" + + success = True + + schema_name = model.schema.upper() + model_name = model.name.upper() + table_key = f"{schema_name}.{model_name}" + + api_table = ctx.tables.get(table_key) + if not api_table: + logger.error("Table %s does not exist in Metabase", table_key) + return False + + # Empty strings not accepted by Metabase + model_display_name = model.display_name or None + model_description = model.format_description(append_tags, docs_url) or None + model_points_of_interest = model.points_of_interest or None + model_caveats = model.caveats or None + model_visibility = model.visibility_type or None + + body_table = {} + + # Update if specified, otherwise reset one that had been set + api_display_name = api_table.get("display_name") + if api_display_name != model_display_name and ( + model_display_name + or safe_name(api_display_name) != safe_name(api_table.get("name")) + ): + body_table["display_name"] = model_display_name + + if api_table.get("description") != model_description: + body_table["description"] = model_description + if api_table.get("points_of_interest") != model_points_of_interest: + body_table["points_of_interest"] = model_points_of_interest + if api_table.get("caveats") != model_caveats: + body_table["caveats"] = model_caveats + if api_table.get("visibility_type") != model_visibility: + body_table["visibility_type"] = model_visibility + + if body_table: + ctx.queue_update(entity=api_table, delta=body_table) + logger.info("Table %s will be updated", table_key) + else: + logger.info("Table %s is up-to-date", table_key) + + for column in model.columns: + success &= self.__export_column(ctx, schema_name, model_name, column) + + return success + + def __export_column( + self, + ctx: _Context, + schema_name: str, + model_name: str, + column: Column, + ) -> bool: + """Exports one dbt column to Metabase database schema. + + Arguments: + schema_name {str} -- Target schema name.s + model_name {str} -- One dbt model name read from project. + column {dict} -- One dbt column read from project. + + Returns: + bool -- True if exported successfully, false if there were errors. + """ + + success = True + + table_key = f"{schema_name}.{model_name}" + column_name = column.name.upper() + + api_field = ctx.tables.get(table_key, {}).get("fields", {}).get(column_name) + if not api_field: + logger.error( + "Field %s.%s does not exist in Metabase", + table_key, + column_name, + ) + return False + + if "special_type" in api_field: + semantic_type_key = "special_type" + else: + semantic_type_key = "semantic_type" + + fk_target_field_id = None + if column.semantic_type == "type/FK": + # Target table could be aliased if we parse_ref() on a source, so we caught aliases during model parsing + # This way we can unpack any alias mapped to fk_target_table when using yml project reader + target_table = ( + column.fk_target_table.upper() + if column.fk_target_table is not None + else None + ) + target_field = ( + column.fk_target_field.upper() + if column.fk_target_field is not None + else None + ) + + if not target_table or not target_field: + logger.info( + "Skipping FK resolution for %s table, %s field not resolved during dbt parsing", + table_key, + target_field, + ) + + else: + logger.debug( + "Looking for field %s in table %s", + target_field, + target_table, + ) + + fk_target_field = ( + ctx.tables.get(target_table, {}).get("fields", {}).get(target_field) + ) + if fk_target_field: + fk_target_field_id = fk_target_field.get("id") + if fk_target_field.get(semantic_type_key) != "type/PK": + logger.info( + "API field/%s will become PK (for %s column FK)", + fk_target_field_id, + column_name, + ) + body_fk_target_field = { + semantic_type_key: "type/PK", + } + ctx.queue_update( + entity=fk_target_field, delta=body_fk_target_field + ) + else: + logger.info( + "API field/%s is already PK (for %s column FK)", + fk_target_field_id, + column_name, + ) + else: + logger.error( + "Unable to find PK for %s.%s column FK", + target_table, + target_field, + ) + success = False + + # Empty strings not accepted by Metabase + column_description = column.description or None + column_display_name = column.display_name or None + column_visibility = column.visibility_type or "normal" + + # Preserve this relationship by default + if api_field["fk_target_field_id"] and not fk_target_field_id: + fk_target_field_id = api_field["fk_target_field_id"] + + body_field: MutableMapping[str, Optional[Any]] = {} + + # Update if specified, otherwise reset one that had been set + api_display_name = api_field.get("display_name") + if api_display_name != column_display_name and ( + column_display_name + or safe_name(api_display_name) != safe_name(api_field.get("name")) + ): + body_field["display_name"] = column_display_name + + if api_field.get("description") != column_description: + body_field["description"] = column_description + if api_field.get("visibility_type") != column_visibility: + body_field["visibility_type"] = column_visibility + if api_field.get("fk_target_field_id") != fk_target_field_id: + body_field["fk_target_field_id"] = fk_target_field_id + if ( + api_field.get("has_field_values") != column.has_field_values + and column.has_field_values + ): + body_field["has_field_values"] = column.has_field_values + if ( + api_field.get("coercion_strategy") != column.coercion_strategy + and column.coercion_strategy + ): + body_field["coercion_strategy"] = column.coercion_strategy + + settings = api_field.get("settings") or {} + if settings.get("number_style") != column.number_style and column.number_style: + settings["number_style"] = column.number_style + + if settings: + body_field["settings"] = settings + + # Allow explicit null type to override detected one + api_semantic_type = api_field.get(semantic_type_key) + if (column.semantic_type and api_semantic_type != column.semantic_type) or ( + column.semantic_type is NullValue and api_semantic_type + ): + body_field[semantic_type_key] = column.semantic_type or None + + if body_field: + ctx.queue_update(entity=api_field, delta=body_field) + logger.info("Field %s.%s will be updated", model_name, column_name) + else: + logger.info("Field %s.%s is up-to-date", model_name, column_name) + + return success + + def __get_tables(self, database_id: str) -> Mapping[str, MutableMapping]: + tables = {} + + metadata = self.metabase_api( + method="get", + path=f"/api/database/{database_id}/metadata", + params={"include_hidden": True}, + ) + + bigquery_schema = metadata.get("details", {}).get("dataset-id") + + for table in metadata.get("tables", []): + # table[schema] is null for bigquery datasets + table["schema"] = ( + table.get("schema") or bigquery_schema or DEFAULT_SCHEMA + ).upper() + + fields = {} + for field in table.get("fields", []): + new_field = field.copy() + new_field["kind"] = "field" + + field_name = field["name"].upper() + fields[field_name] = new_field + + new_table = table.copy() + new_table["kind"] = "table" + new_table["fields"] = fields + + schema_name = table["schema"].upper() + table_name = table["name"].upper() + tables[f"{schema_name}.{table_name}"] = new_table + + return tables + + def __filtered_models( + self, + models: Iterable[Model], + database_filter: Optional[Filter], + schema_filter: Optional[Filter], + model_filter: Optional[Filter], + skip_sources: bool, + ) -> Iterable[Model]: + def selected(m: Model) -> bool: + return ( + (not skip_sources or m.group != Group.sources) + and (not database_filter or database_filter.selected(m.database)) + and (not schema_filter or schema_filter.selected(m.schema)) + and (not model_filter or model_filter.selected(m.name)) + ) + + return list(filter(selected, models)) + + +class _Context: + def __init__(self): + self.tables: Mapping[str, MutableMapping] = {} + self.updates: MutableMapping[str, MutableMapping[str, Any]] = {} + + def queue_update(self, entity: MutableMapping, delta: Mapping): + entity.update(delta) + + key = f"{entity['kind']}.{entity['id']}" + update = self.updates.get(key, {}) + update["kind"] = entity["kind"] + update["id"] = entity["id"] + + body = update.get("body", {}) + body.update(delta) + update["body"] = body + + self.updates[key] = update diff --git a/dbtmetabase/dbt.py b/dbtmetabase/dbt.py deleted file mode 100644 index 00403514..00000000 --- a/dbtmetabase/dbt.py +++ /dev/null @@ -1,509 +0,0 @@ -import dataclasses -import json -import logging -import re -from enum import Enum -from pathlib import Path -from typing import Iterable, List, Mapping, MutableMapping, Optional, Sequence - -logger = logging.getLogger(__name__) - -# Allowed metabase.* fields -_METABASE_COMMON_META_FIELDS = [ - "display_name", - "visibility_type", -] -# Must be covered by MetabaseColumn attributes -METABASE_COLUMN_META_FIELDS = _METABASE_COMMON_META_FIELDS + [ - "semantic_type", - "has_field_values", - "coercion_strategy", - "number_style", -] -# Must be covered by MetabaseModel attributes -METABASE_MODEL_META_FIELDS = _METABASE_COMMON_META_FIELDS + [ - "points_of_interest", - "caveats", -] - -# Default model schema (only schema in BigQuery) -METABASE_MODEL_DEFAULT_SCHEMA = "PUBLIC" - - -class ModelType(str, Enum): - nodes = "nodes" - sources = "sources" - - -@dataclasses.dataclass -class MetabaseColumn: - name: str - description: Optional[str] = None - - display_name: Optional[str] = None - visibility_type: Optional[str] = None - semantic_type: Optional[str] = None - has_field_values: Optional[str] = None - coercion_strategy: Optional[str] = None - number_style: Optional[str] = None - - fk_target_table: Optional[str] = None - fk_target_field: Optional[str] = None - - meta_fields: MutableMapping = dataclasses.field(default_factory=dict) - - -@dataclasses.dataclass -class MetabaseModel: - name: str - schema: str - description: str = "" - - display_name: Optional[str] = None - visibility_type: Optional[str] = None - points_of_interest: Optional[str] = None - caveats: Optional[str] = None - - model_type: ModelType = ModelType.nodes - source: Optional[str] = None - unique_id: Optional[str] = None - - columns: Sequence[MetabaseColumn] = dataclasses.field(default_factory=list) - - @property - def ref(self) -> Optional[str]: - if self.model_type == ModelType.nodes: - return f"ref('{self.name}')" - elif self.model_type == ModelType.sources: - return f"source('{self.source}', '{self.name}')" - return None - - -class _NullValue(str): - """Explicitly null field value.""" - - def __eq__(self, other: object) -> bool: - return other is None - - -NullValue = _NullValue() - - -class DbtReader: - def __init__( - self, - manifest_path: str, - database: str, - schema: Optional[str] = None, - schema_excludes: Optional[Iterable] = None, - includes: Optional[Iterable] = None, - excludes: Optional[Iterable] = None, - ): - """Reader for compiled dbt manifest.json file. - - Args: - manifest_path (str, optional): Path to dbt manifest.json (usually under target/). Defaults to None. - database (str, optional): Target database name specified in dbt models. Default to None. - schema (str, optional): Target schema. Defaults to None. - schema_excludes (Iterable, optional): Target schemas to exclude. Defaults to None. - includes (Iterable, optional): Model names to limit selection. Defaults to None. - excludes (Iterable, optional): Model names to exclude from selection. Defaults to None. - """ - - self.manifest_path = Path(manifest_path).expanduser() - self.database = database.upper() - self.schema = schema.upper() if schema else None - self.schema_excludes = [x.upper() for x in schema_excludes or []] - - self.includes = [x.upper() for x in includes or []] - self.excludes = [x.upper() for x in excludes or []] - - def read_models( - self, - include_tags: bool = True, - docs_url: Optional[str] = None, - ) -> List[MetabaseModel]: - """Reads dbt models in Metabase-friendly format. - - Keyword Arguments: - include_tags {bool} -- Append dbt model tags to dbt model descriptions. (default: {True}) - docs_url {Optional[str]} -- Append dbt docs url to dbt model description - - Returns: - list -- List of dbt models in Metabase-friendly format. - """ - - with open(self.manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - - mb_models: List[MetabaseModel] = [] - - for _, node in manifest["nodes"].items(): - model_name = node["name"].upper() - model_schema = node["schema"].upper() - model_database = node["database"].upper() - - if node["resource_type"] != "model": - logger.debug("Skipping %s not of resource type model", model_name) - continue - - if node["config"]["materialized"] == "ephemeral": - logger.debug( - "Skipping ephemeral model %s not manifested in database", model_name - ) - continue - - if model_database != self.database: - logger.debug( - "Skipping %s in database %s, not in target database %s", - model_name, - model_database, - self.database, - ) - continue - - if self.schema and model_schema != self.schema: - logger.debug( - "Skipping %s in schema %s not in target schema %s", - model_name, - model_schema, - self.schema, - ) - continue - - if model_schema in self.schema_excludes: - logger.debug( - "Skipping %s in schema %s marked for exclusion", - model_name, - model_schema, - ) - continue - - if not self.model_selected(model_name): - logger.debug( - "Skipping %s not included in includes or excluded by excludes", - model_name, - ) - continue - - mb_models.append( - self._read_model( - manifest, - node, - include_tags=include_tags, - docs_url=docs_url, - model_type=ModelType.nodes, - source=None, - ) - ) - - for _, node in manifest["sources"].items(): - source_name = node.get("identifier", node.get("name")).upper() - source_schema = node["schema"].upper() - source_database = node["database"].upper() - - if node["resource_type"] != "source": - logger.debug("Skipping %s not of resource type source", source_name) - continue - - if source_database != self.database: - logger.debug( - "Skipping %s not in target database %s", source_name, self.database - ) - continue - - if self.schema and source_schema != self.schema: - logger.debug( - "Skipping %s in schema %s not in target schema %s", - source_name, - source_schema, - self.schema, - ) - continue - - if source_schema in self.schema_excludes: - logger.debug( - "Skipping %s in schema %s marked for exclusion", - source_name, - source_schema, - ) - continue - - if not self.model_selected(source_name): - logger.debug( - "Skipping %s not included in includes or excluded by excludes", - source_name, - ) - continue - - mb_models.append( - self._read_model( - manifest, - node, - include_tags=include_tags, - docs_url=docs_url, - model_type=ModelType.sources, - source=node["source_name"], - ) - ) - - return mb_models - - def _read_model( - self, - manifest: Mapping, - model: dict, - source: Optional[str] = None, - model_type: ModelType = ModelType.nodes, - include_tags: bool = True, - docs_url: Optional[str] = None, - ) -> MetabaseModel: - metabase_columns: List[MetabaseColumn] = [] - - schema = model["schema"].upper() - unique_id = model["unique_id"] - - relationships = self._read_model_relationships( - manifest=manifest, - model_type=model_type, - unique_id=unique_id, - ) - - for _, column in model.get("columns", {}).items(): - metabase_columns.append( - self._read_column( - column=column, - schema=schema, - relationship=relationships.get(column["name"]), - ) - ) - - description = model.get("description", "") - - if include_tags: - tags = model.get("tags", []) - if tags: - tags = ", ".join(tags) - if description != "": - description += "\n\n" - description += f"Tags: {tags}" - - if docs_url: - full_path = f"{docs_url}/#!/model/{unique_id}" - if description != "": - description += "\n\n" - description += f"dbt docs link: {full_path}" - - resolved_name = model.get("alias", model.get("identifier", model["name"])) - - return MetabaseModel( - name=resolved_name, - schema=schema, - description=description, - columns=metabase_columns, - model_type=model_type, - unique_id=unique_id, - source=source, - **self.read_meta_fields(model, METABASE_MODEL_META_FIELDS), - ) - - def _read_model_relationships( - self, manifest: Mapping, model_type: ModelType, unique_id: str - ) -> Mapping[str, Mapping[str, str]]: - children = manifest["child_map"][unique_id] - relationship_tests = {} - - for child_id in children: - child = {} - if manifest[model_type]: - child = manifest[model_type].get(child_id, {}) - - # Only proceed if we are seeing an explicitly declared relationship test - if ( - child.get("resource_type") == "test" - and child.get("test_metadata", {}).get("name") == "relationships" - ): - # To get the name of the foreign table, we could use child['test_metadata']['kwargs']['to'], which - # would return the ref() written in the test, but if the model has an alias, that's not enough. - # It is better to use child['depends_on']['nodes'] and exclude the current model - - # From experience, nodes contains at most two tables: the referenced model and the current model. - # Note, sometimes only the referenced model is returned. - depends_on_nodes = list(child["depends_on"][model_type]) - if len(depends_on_nodes) > 2: - logger.warning( - "Expected at most two nodes, got %d {} nodes, skipping %s {}", - len(depends_on_nodes), - unique_id, - ) - continue - - # Skip the incoming relationship tests, in which the fk_target_table is the model currently being read. - # Otherwise, the primary key of the current model would be (incorrectly) determined to be a foreign key. - is_incoming_relationship_test = depends_on_nodes[1] != unique_id - if len(depends_on_nodes) == 2 and is_incoming_relationship_test: - logger.debug( - "Skip this incoming relationship test, concerning nodes %s.", - depends_on_nodes, - ) - continue - - # Remove the current model from the list. Note, remove() only removes the first occurrence. This ensures - # the logic also works for self referencing models. - if len(depends_on_nodes) == 2 and unique_id in depends_on_nodes: - depends_on_nodes.remove(unique_id) - - if len(depends_on_nodes) != 1: - logger.warning( - "Expected single node after filtering, got %d nodes, skipping %s", - len(depends_on_nodes), - unique_id, - ) - continue - - depends_on_id = depends_on_nodes[0] - - foreign_key_model = manifest[model_type].get(depends_on_id, {}) - fk_target_table_alias = foreign_key_model.get( - "alias", - foreign_key_model.get("identifier", foreign_key_model.get("name")), - ) - - if not fk_target_table_alias: - logger.debug( - "Could not resolve depends on model id %s to a model in manifest", - depends_on_id, - ) - continue - - fk_target_schema = manifest[model_type][depends_on_id].get( - "schema", METABASE_MODEL_DEFAULT_SCHEMA - ) - fk_target_field = child["test_metadata"]["kwargs"]["field"].strip('"') - - relationship_tests[child["column_name"]] = { - "fk_target_table": f"{fk_target_schema}.{fk_target_table_alias}", - "fk_target_field": fk_target_field, - } - - return relationship_tests - - def _read_column( - self, - column: Mapping, - schema: str, - relationship: Optional[Mapping], - ) -> MetabaseColumn: - column_name = column.get("name", "").upper().strip('"') - column_description = column.get("description") - metabase_column = MetabaseColumn( - name=column_name, - description=column_description, - **self.read_meta_fields(column, METABASE_COLUMN_META_FIELDS), - ) - - self.set_column_foreign_key( - column=column, - metabase_column=metabase_column, - table=relationship["fk_target_table"] if relationship else None, - field=relationship["fk_target_field"] if relationship else None, - schema=schema, - ) - - return metabase_column - - def model_selected(self, name: str) -> bool: - """Checks whether model passes inclusion/exclusion criteria. - - Args: - name (str): Model name. - - Returns: - bool: True if included, false otherwise. - """ - n = name.upper() - return n not in self.excludes and (not self.includes or n in self.includes) - - def set_column_foreign_key( - self, - column: Mapping, - metabase_column: MetabaseColumn, - table: Optional[str], - field: Optional[str], - schema: Optional[str], - ): - """Sets foreign key target on a column. - - Args: - column (Mapping): Schema column definition. - metabase_column (MetabaseColumn): Metabase column definition. - table (str): Foreign key target table. - field (str): Foreign key target field. - schema (str): Current schema name. - """ - # Meta fields take precedence - meta = column.get("meta", {}) - table = meta.get("metabase.fk_target_table", table) - field = meta.get("metabase.fk_target_field", field) - - if not table or not field: - if table or field: - logger.warning( - "Foreign key requires table and field for column %s", - metabase_column.name, - ) - return - - table_path = table.split(".") - if len(table_path) == 1 and schema: - table_path.insert(0, schema) - - metabase_column.semantic_type = "type/FK" - metabase_column.fk_target_table = ".".join( - [x.strip('"').upper() for x in table_path] - ) - metabase_column.fk_target_field = field.strip('"').upper() - logger.debug( - "Relation from %s to %s.%s", - metabase_column.name, - metabase_column.fk_target_table, - metabase_column.fk_target_field, - ) - - @staticmethod - def read_meta_fields(obj: Mapping, fields: List) -> Mapping: - """Reads meta fields from a schem object. - - Args: - obj (Mapping): Schema object. - fields (List): List of fields to read. - - Returns: - Mapping: Field values. - """ - - vals = {} - meta = obj.get("meta", {}) - for field in fields: - if f"metabase.{field}" in meta: - value = meta[f"metabase.{field}"] - vals[field] = value if value is not None else NullValue - return vals - - @staticmethod - def parse_ref(text: str) -> Optional[str]: - """Parses dbt ref() or source() statement. - - Arguments: - text {str} -- Full statement in dbt YAML. - - Returns: - str -- Name of the reference. - """ - - # We are catching the rightmost argument of either source or ref which is ultimately the table name - matches = re.findall(r"['\"]([\w\_\-\ ]+)['\"][ ]*\)$", text.strip()) - if matches: - logger.debug("%s -> %s", text, matches[0]) - return matches[0] - return None diff --git a/dbtmetabase/interface.py b/dbtmetabase/interface.py new file mode 100644 index 00000000..e8beade8 --- /dev/null +++ b/dbtmetabase/interface.py @@ -0,0 +1,36 @@ +from typing import Optional, Sequence + + +class MetabaseArgumentError(ValueError): + """Invalid Metabase arguments supplied.""" + + +class MetabaseRuntimeError(RuntimeError): + """Metabase execution failed.""" + + +class Filter: + """Inclusion/exclusion filtering.""" + + def __init__( + self, + include: Optional[Sequence[str]] = None, + exclude: Optional[Sequence[str]] = None, + ): + """ + Args: + include (Optional[Sequence[str]], optional): Optional inclusions (i.e. include only these). Defaults to None. + exclude (Optional[Sequence[str]], optional): Optional exclusion list (i.e. exclude these, even if in inclusion list). Defaults to None. + """ + self.include = [self._norm(x) for x in include or []] + self.exclude = [self._norm(x) for x in exclude or []] + + def selected(self, item: str) -> bool: + item = self._norm(item) + included = not self.include or item in self.include + excluded = self.exclude and item in self.exclude + return included and not excluded + + @classmethod + def _norm(cls, x: str) -> str: + return x.upper() diff --git a/dbtmetabase/manifest.py b/dbtmetabase/manifest.py new file mode 100644 index 00000000..2b395249 --- /dev/null +++ b/dbtmetabase/manifest.py @@ -0,0 +1,355 @@ +from __future__ import annotations + +import dataclasses +import json +import logging +from enum import Enum +from pathlib import Path +from typing import ( + Iterable, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Union, +) + +from ._format import scan_fields + +_logger = logging.getLogger(__name__) + +# Namespace for meta fields, e.g. metabase.field +_META_NS = "metabase" +# Allowed namespace fields +_COMMON_META_FIELDS = [ + "display_name", + "visibility_type", +] +# Must be covered by Column attributes +_COLUMN_META_FIELDS = _COMMON_META_FIELDS + [ + "semantic_type", + "has_field_values", + "coercion_strategy", + "number_style", +] +# Must be covered by Model attributes +_MODEL_META_FIELDS = _COMMON_META_FIELDS + [ + "points_of_interest", + "caveats", +] + +# Default model schema (only schema in BigQuery) +DEFAULT_SCHEMA = "PUBLIC" + + +class Manifest: + """dbt manifest reader.""" + + def __init__(self, path: Union[str, Path]): + """Reader for compiled dbt manifest.json file. + + Args: + path (Union[str, Path]): Path to dbt manifest.json (usually under target/). + """ + + self.path = Path(path).expanduser() + + def read_models(self) -> Iterable[Model]: + """Reads dbt models in Metabase-friendly format. + + Returns: + Iterable[Model]: List of dbt models in Metabase-friendly format. + """ + + with open(self.path, "r", encoding="utf-8") as f: + manifest = json.load(f) + + models: MutableSequence[Model] = [] + + for node in manifest["nodes"].values(): + if node["resource_type"] != "model": + continue + + name = node["name"].upper() + if node["config"]["materialized"] == "ephemeral": + _logger.debug("Skipping ephemeral model %s", name) + continue + + models.append(self._read_model(manifest, node, Group.nodes)) + + for node in manifest["sources"].values(): + if node["resource_type"] != "source": + continue + + models.append( + self._read_model(manifest, node, Group.sources, node["source_name"]) + ) + + return models + + def _read_model( + self, + manifest: Mapping, + model: Mapping, + group: Group, + source: Optional[str] = None, + ) -> Model: + database = model["database"].upper() + schema = model["schema"].upper() + unique_id = model["unique_id"] + + relationships = self._read_relationships(manifest, group, unique_id) + + metabase_columns = [ + self._read_column(column, schema, relationships.get(column["name"])) + for column in model.get("columns", {}).values() + ] + + return Model( + database=database, + schema=schema, + group=group, + name=model.get("alias", model.get("identifier", model["name"])), + description=model.get("description"), + columns=metabase_columns, + unique_id=unique_id, + source=source, + tags=model.get("tags", []), + **scan_fields( + model.get("meta", {}), + fields=_MODEL_META_FIELDS, + ns=_META_NS, + ), + ) + + def _read_column( + self, + column: Mapping, + schema: str, + relationship: Optional[Mapping], + ) -> Column: + metabase_column = Column( + name=column.get("name", "").upper().strip('"'), + description=column.get("description"), + **scan_fields( + column.get("meta", {}), + fields=_COLUMN_META_FIELDS, + ns=_META_NS, + ), + ) + + self._set_column_fk( + column=column, + metabase_column=metabase_column, + table=relationship["fk_target_table"] if relationship else None, + field=relationship["fk_target_field"] if relationship else None, + schema=schema, + ) + + return metabase_column + + def _read_relationships( + self, + manifest: Mapping, + group: Group, + unique_id: str, + ) -> Mapping[str, Mapping[str, str]]: + relationships = {} + + for child_id in manifest["child_map"][unique_id]: + child = {} + if manifest[group]: + child = manifest[group].get(child_id, {}) + + if ( + child.get("resource_type") == "test" + and child.get("test_metadata", {}).get("name") == "relationships" + ): + # To get the name of the foreign table, we could use child[test_metadata][kwargs][to], which + # would return the ref() written in the test, but if the model has an alias, that's not enough. + # Using child[depends_on][nodes] and excluding the current model is better. + + # Nodes contain at most two tables: referenced model and current model (optional). + depends_on_nodes = list(child["depends_on"][group]) + if len(depends_on_nodes) > 2: + _logger.warning( + "Expected at most two nodes, got %d {} nodes, skipping %s {}", + len(depends_on_nodes), + unique_id, + ) + continue + + # Skip the incoming relationship tests, in which the fk_target_table is the model currently being read. + # Otherwise, the primary key of the current model would be (incorrectly) determined to be FK. + is_incoming_relationship_test = depends_on_nodes[1] != unique_id + if len(depends_on_nodes) == 2 and is_incoming_relationship_test: + _logger.debug( + "Skip this incoming relationship test, concerning nodes %s", + depends_on_nodes, + ) + continue + + # Remove the current model from the list, ensuring it works for self-referencing models. + if len(depends_on_nodes) == 2 and unique_id in depends_on_nodes: + depends_on_nodes.remove(unique_id) + + if len(depends_on_nodes) != 1: + _logger.warning( + "Expected single node after filtering, got %d instead, skipping %s", + len(depends_on_nodes), + unique_id, + ) + continue + + depends_on_id = depends_on_nodes[0] + + fk_model = manifest[group].get(depends_on_id, {}) + fk_target_table_alias = fk_model.get( + "alias", fk_model.get("identifier", fk_model.get("name")) + ) + + if not fk_target_table_alias: + _logger.debug( + "Cannot resolve depends on model %s to a model in manifest", + depends_on_id, + ) + continue + + fk_target_schema = manifest[group][depends_on_id].get( + "schema", DEFAULT_SCHEMA + ) + fk_target_field = child["test_metadata"]["kwargs"]["field"].strip('"') + + relationships[child["column_name"]] = { + "fk_target_table": f"{fk_target_schema}.{fk_target_table_alias}", + "fk_target_field": fk_target_field, + } + + return relationships + + def _set_column_fk( + self, + column: Mapping, + metabase_column: Column, + table: Optional[str], + field: Optional[str], + schema: Optional[str], + ): + """Sets foreign key target on a column. + + Args: + column (Mapping): Schema column definition. + metabase_column (Column): Metabase column definition. + table (str): Foreign key target table. + field (str): Foreign key target field. + schema (str): Current schema name. + """ + # Meta fields take precedence + meta = column.get("meta", {}) + table = meta.get(f"{_META_NS}.fk_target_table", table) + field = meta.get(f"{_META_NS}.fk_target_field", field) + + if not table or not field: + if table or field: + _logger.warning( + "FK requires table and field for column %s", + metabase_column.name, + ) + return + + table_path = table.split(".") + if len(table_path) == 1 and schema: + table_path.insert(0, schema) + + metabase_column.semantic_type = "type/FK" + metabase_column.fk_target_table = ".".join( + [x.strip('"').upper() for x in table_path] + ) + metabase_column.fk_target_field = field.strip('"').upper() + _logger.debug( + "Relation from %s to %s.%s", + metabase_column.name, + metabase_column.fk_target_table, + metabase_column.fk_target_field, + ) + + +class Group(str, Enum): + nodes = "nodes" + sources = "sources" + + +@dataclasses.dataclass +class Column: + name: str + description: Optional[str] = None + display_name: Optional[str] = None + visibility_type: Optional[str] = None + semantic_type: Optional[str] = None + has_field_values: Optional[str] = None + coercion_strategy: Optional[str] = None + number_style: Optional[str] = None + + fk_target_table: Optional[str] = None + fk_target_field: Optional[str] = None + + meta_fields: MutableMapping = dataclasses.field(default_factory=dict) + + +@dataclasses.dataclass +class Model: + database: str + schema: str + group: Group + + name: str + description: Optional[str] = None + display_name: Optional[str] = None + visibility_type: Optional[str] = None + points_of_interest: Optional[str] = None + caveats: Optional[str] = None + + unique_id: Optional[str] = None + source: Optional[str] = None + tags: Optional[Sequence[str]] = None + + columns: Sequence[Column] = dataclasses.field(default_factory=list) + + @property + def ref(self) -> Optional[str]: + if self.group == Group.nodes: + return f"ref('{self.name}')" + elif self.group == Group.sources: + return f"source('{self.source}', '{self.name}')" + return None + + def format_description( + self, + append_tags: bool = False, + docs_url: Optional[str] = None, + ) -> str: + """Formats description from available information. + + Args: + append_tags (bool, optional): True to include dbt model tags. Defaults to False. + docs_url (Optional[str], optional): Provide docs base URL to include links. Defaults to None. + + Returns: + str: Formatted description. + """ + + sections = [] + + if self.description: + sections.append(self.description) + + if append_tags and self.tags: + sections.append(f"Tags: {', '.join(self.tags)}") + + if docs_url: + sections.append( + f"dbt docs: {docs_url.rstrip('/')}/#!/model/{self.unique_id}" + ) + + return "\n\n".join(sections) diff --git a/dbtmetabase/metabase.py b/dbtmetabase/metabase.py deleted file mode 100644 index 393ca16e..00000000 --- a/dbtmetabase/metabase.py +++ /dev/null @@ -1,970 +0,0 @@ -from __future__ import annotations - -import logging -import re -import time -from pathlib import Path -from typing import ( - Any, - Dict, - Iterable, - List, - Mapping, - MutableMapping, - Optional, - Tuple, - Union, -) - -import requests -import yaml -from requests.adapters import HTTPAdapter, Retry - -from ._format import safe_description, safe_name -from .dbt import ( - METABASE_MODEL_DEFAULT_SCHEMA, - MetabaseColumn, - MetabaseModel, - ModelType, - NullValue, -) - -logger = logging.getLogger(__name__) - - -class MetabaseArgumentError(ValueError): - """Invalid Metabase arguments supplied.""" - - -class MetabaseRuntimeError(RuntimeError): - """Metabase execution failed.""" - - -class _MetabaseClientJob: - """Scoped abstraction for jobs depending on the Metabase client.""" - - def __init__(self, client: MetabaseClient): - self.client = client - - -class _ExportModelsJob(_MetabaseClientJob): - """Job abstraction for exporting models.""" - - _SYNC_PERIOD = 5 - - def __init__( - self, - client: MetabaseClient, - database: str, - models: List[MetabaseModel], - exclude_sources: bool, - sync_timeout: int, - ): - super().__init__(client) - - self.database = database - self.models = [ - model - for model in models - if model.model_type != ModelType.sources or not exclude_sources - ] - self.sync_timeout = sync_timeout - - self.tables: Mapping[str, MutableMapping] = {} - self.updates: MutableMapping[str, MutableMapping[str, Any]] = {} - - def execute(self): - success = True - - database_id = None - for database in self.client.api("get", "/api/database"): - if database["name"].upper() == self.database.upper(): - database_id = database["id"] - break - if not database_id: - raise MetabaseRuntimeError(f"Cannot find database by name {self.database}") - - if self.sync_timeout: - self.client.api("post", f"/api/database/{database_id}/sync_schema") - time.sleep(self._SYNC_PERIOD) - - deadline = int(time.time()) + self.sync_timeout - synced = False - while not synced: - tables = self._load_tables(database_id) - - synced = True - for model in self.models: - schema_name = model.schema.upper() - model_name = model.name.upper() - table_key = f"{schema_name}.{model_name}" - - table = tables.get(table_key) - if not table: - logger.warning( - "Model %s not found in %s schema", table_key, schema_name - ) - synced = False - continue - - for column in model.columns: - column_name = column.name.upper() - - field = table.get("fields", {}).get(column_name) - if not field: - logger.warning( - "Column %s not found in %s model", column_name, table_key - ) - synced = False - continue - - self.tables = tables - - if int(time.time()) < deadline: - time.sleep(self._SYNC_PERIOD) - - if not synced and self.sync_timeout: - raise MetabaseRuntimeError("Unable to sync models between dbt and Metabase") - - for model in self.models: - success &= self._export_model(model) - - for update in self.updates.values(): - self.client.api( - "put", - f"/api/{update['kind']}/{update['id']}", - json=update["body"], - ) - logger.info( - "API %s/%s updated successfully: %s", - update["kind"], - update["id"], - ", ".join(update.get("body", {}).keys()), - ) - - if not success: - raise MetabaseRuntimeError( - "Model export encountered non-critical errors, check output" - ) - - def queue_update(self, entity: MutableMapping, delta: Mapping): - entity.update(delta) - - key = f"{entity['kind']}.{entity['id']}" - update = self.updates.get(key, {}) - update["kind"] = entity["kind"] - update["id"] = entity["id"] - - body = update.get("body", {}) - body.update(delta) - update["body"] = body - - self.updates[key] = update - - def _export_model(self, model: MetabaseModel) -> bool: - """Exports one dbt model to Metabase database schema. - - Arguments: - model {dict} -- One dbt model read from project. - - Returns: - bool -- True if exported successfully, false if there were errors. - """ - - success = True - - schema_name = model.schema.upper() - model_name = model.name.upper() - table_key = f"{schema_name}.{model_name}" - - api_table = self.tables.get(table_key) - if not api_table: - logger.error("Table %s does not exist in Metabase", table_key) - return False - - # Empty strings not accepted by Metabase - model_display_name = model.display_name or None - model_description = model.description or None - model_points_of_interest = model.points_of_interest or None - model_caveats = model.caveats or None - model_visibility = model.visibility_type or None - - body_table = {} - - # Update if specified, otherwise reset one that had been set - api_display_name = api_table.get("display_name") - if api_display_name != model_display_name and ( - model_display_name - or safe_name(api_display_name) != safe_name(api_table.get("name")) - ): - body_table["display_name"] = model_display_name - - if api_table.get("description") != model_description: - body_table["description"] = model_description - if api_table.get("points_of_interest") != model_points_of_interest: - body_table["points_of_interest"] = model_points_of_interest - if api_table.get("caveats") != model_caveats: - body_table["caveats"] = model_caveats - if api_table.get("visibility_type") != model_visibility: - body_table["visibility_type"] = model_visibility - - if body_table: - self.queue_update(entity=api_table, delta=body_table) - logger.info("Table %s will be updated", table_key) - else: - logger.info("Table %s is up-to-date", table_key) - - for column in model.columns: - success &= self._export_column(schema_name, model_name, column) - - return success - - def _export_column( - self, - schema_name: str, - model_name: str, - column: MetabaseColumn, - ) -> bool: - """Exports one dbt column to Metabase database schema. - - Arguments: - schema_name {str} -- Target schema name.s - model_name {str} -- One dbt model name read from project. - column {dict} -- One dbt column read from project. - - Returns: - bool -- True if exported successfully, false if there were errors. - """ - - success = True - - table_key = f"{schema_name}.{model_name}" - column_name = column.name.upper() - - api_field = self.tables.get(table_key, {}).get("fields", {}).get(column_name) - if not api_field: - logger.error( - "Field %s.%s does not exist in Metabase", - table_key, - column_name, - ) - return False - - if "special_type" in api_field: - semantic_type_key = "special_type" - else: - semantic_type_key = "semantic_type" - - fk_target_field_id = None - if column.semantic_type == "type/FK": - # Target table could be aliased if we parse_ref() on a source, so we caught aliases during model parsing - # This way we can unpack any alias mapped to fk_target_table when using yml project reader - target_table = ( - column.fk_target_table.upper() - if column.fk_target_table is not None - else None - ) - target_field = ( - column.fk_target_field.upper() - if column.fk_target_field is not None - else None - ) - - if not target_table or not target_field: - logger.info( - "Skipping FK resolution for %s table, %s field not resolved during dbt parsing", - table_key, - target_field, - ) - - else: - logger.debug( - "Looking for field %s in table %s", - target_field, - target_table, - ) - - fk_target_field = ( - self.tables.get(target_table, {}) - .get("fields", {}) - .get(target_field) - ) - if fk_target_field: - fk_target_field_id = fk_target_field.get("id") - if fk_target_field.get(semantic_type_key) != "type/PK": - logger.info( - "API field/%s will become PK (for %s column FK)", - fk_target_field_id, - column_name, - ) - body_fk_target_field = { - semantic_type_key: "type/PK", - } - self.queue_update( - entity=fk_target_field, delta=body_fk_target_field - ) - else: - logger.info( - "API field/%s is already PK (for %s column FK)", - fk_target_field_id, - column_name, - ) - else: - logger.error( - "Unable to find PK for %s.%s column FK", - target_table, - target_field, - ) - success = False - - # Empty strings not accepted by Metabase - column_description = column.description or None - column_display_name = column.display_name or None - column_visibility = column.visibility_type or "normal" - - # Preserve this relationship by default - if api_field["fk_target_field_id"] and not fk_target_field_id: - fk_target_field_id = api_field["fk_target_field_id"] - - body_field: MutableMapping[str, Optional[Any]] = {} - - # Update if specified, otherwise reset one that had been set - api_display_name = api_field.get("display_name") - if api_display_name != column_display_name and ( - column_display_name - or safe_name(api_display_name) != safe_name(api_field.get("name")) - ): - body_field["display_name"] = column_display_name - - if api_field.get("description") != column_description: - body_field["description"] = column_description - if api_field.get("visibility_type") != column_visibility: - body_field["visibility_type"] = column_visibility - if api_field.get("fk_target_field_id") != fk_target_field_id: - body_field["fk_target_field_id"] = fk_target_field_id - if ( - api_field.get("has_field_values") != column.has_field_values - and column.has_field_values - ): - body_field["has_field_values"] = column.has_field_values - if ( - api_field.get("coercion_strategy") != column.coercion_strategy - and column.coercion_strategy - ): - body_field["coercion_strategy"] = column.coercion_strategy - - settings = api_field.get("settings") or {} - if settings.get("number_style") != column.number_style and column.number_style: - settings["number_style"] = column.number_style - - if settings: - body_field["settings"] = settings - - # Allow explicit null type to override detected one - api_semantic_type = api_field.get(semantic_type_key) - if (column.semantic_type and api_semantic_type != column.semantic_type) or ( - column.semantic_type is NullValue and api_semantic_type - ): - body_field[semantic_type_key] = column.semantic_type or None - - if body_field: - self.queue_update(entity=api_field, delta=body_field) - logger.info("Field %s.%s will be updated", model_name, column_name) - else: - logger.info("Field %s.%s is up-to-date", model_name, column_name) - - return success - - def _load_tables(self, database_id: str) -> Mapping[str, MutableMapping]: - tables = {} - - metadata = self.client.api( - "get", - f"/api/database/{database_id}/metadata", - params={"include_hidden": "true"}, - ) - - bigquery_schema = metadata.get("details", {}).get("dataset-id") - - for table in metadata.get("tables", []): - # table[schema] is null for bigquery datasets - table["schema"] = ( - table.get("schema") or bigquery_schema or METABASE_MODEL_DEFAULT_SCHEMA - ).upper() - - fields = {} - for field in table.get("fields", []): - new_field = field.copy() - new_field["kind"] = "field" - - field_name = field["name"].upper() - fields[field_name] = new_field - - new_table = table.copy() - new_table["kind"] = "table" - new_table["fields"] = fields - - schema_name = table["schema"].upper() - table_name = table["name"].upper() - tables[f"{schema_name}.{table_name}"] = new_table - - return tables - - -class _ExtractExposuresJob(_MetabaseClientJob): - _RESOURCE_VERSION = 2 - - # This regex is looking for from and join clauses, and extracting the table part. - # It won't recognize some valid sql table references, such as `from "table with spaces"`. - _EXPOSURE_PARSER = re.compile(r"[FfJj][RrOo][OoIi][MmNn]\s+([\w.\"]+)") - _CTE_PARSER = re.compile( - r"[Ww][Ii][Tt][Hh]\s+\b(\w+)\b\s+as|[)]\s*[,]\s*\b(\w+)\b\s+as" - ) - - class DbtDumper(yaml.Dumper): - def increase_indent(self, flow=False, indentless=False): - return super().increase_indent(flow, indentless=False) - - def __init__( - self, - client: MetabaseClient, - models: List[MetabaseModel], - output_path: str, - output_grouping: Optional[str], - include_personal_collections: bool, - collection_includes: Optional[Iterable], - collection_excludes: Optional[Iterable], - ): - super().__init__(client) - - self.model_refs = {model.name.upper(): model.ref for model in models} - self.output_path = Path(output_path).expanduser() - - if output_grouping in (None, "collection", "type"): - self.output_grouping = output_grouping - else: - raise ValueError(f"Unsupported output_grouping: {output_grouping}") - - self.include_personal_collections = include_personal_collections - self.collection_includes = collection_includes or [] - self.collection_excludes = collection_excludes or [] - - self.table_names: Mapping = {} - self.models_exposed: List = [] - self.native_query: str = "" - - def execute(self) -> Mapping: - """Extracts exposures in Metabase downstream of dbt models and sources as parsed by dbt reader. - - Returns: - Mapping: JSON object representation of all exposures parsed. - """ - - self.table_names = { - table["id"]: table["name"] for table in self.client.api("get", "/api/table") - } - - documented_exposure_names = [] - parsed_exposures = [] - - for collection in self.client.api("get", "/api/collection"): - # Inclusion/exclusion criteria check - name_included = ( - collection["name"] in self.collection_includes - or not self.collection_includes - ) - name_excluded = collection["name"] in self.collection_excludes - personal_included = self.include_personal_collections or not collection.get( - "personal_owner_id" - ) - if not name_included or name_excluded or not personal_included: - logging.debug("Skipping collection %s", collection["name"]) - continue - - # Iter through collection - logger.info("Exploring collection %s", collection["name"]) - for item in self.client.api( - "get", f"/api/collection/{collection['id']}/items" - ): - # Ensure collection item is of parsable type - exposure_type = item["model"] - exposure_id = item["id"] - if exposure_type not in ("card", "dashboard"): - continue - - # Prepare attributes for population through _extract_card_exposures calls - self.models_exposed = [] - self.native_query = "" - native_query = "" - - exposure = self.client.api("get", f"/api/{exposure_type}/{exposure_id}") - exposure_name = exposure.get("name", "Exposure [Unresolved Name]") - logger.info( - "Introspecting exposure: %s", - exposure_name, - ) - - header = None - creator_name = None - creator_email = None - - # Process exposure - if exposure_type == "card": - # Build header for card and extract models to self.models_exposed - header = "### Visualization: {}\n\n".format( - exposure.get("display", "Unknown").title() - ) - - # Parse Metabase question - self._extract_card_exposures(exposure_id, exposure) - native_query = self.native_query - - elif exposure_type == "dashboard": - # We expect this dict key in order to iter through questions - if "ordered_cards" not in exposure: - continue - - # Build header for dashboard and extract models for each question to self.models_exposed - header = "### Dashboard Cards: {}\n\n".format( - str(len(exposure["ordered_cards"])) - ) - - # Iterate through dashboard questions - for dashboard_item in exposure["ordered_cards"]: - dashboard_item_reference = dashboard_item.get("card", {}) - if "id" not in dashboard_item_reference: - continue - - # Parse Metabase question - self._extract_card_exposures(dashboard_item_reference["id"]) - - if not self.models_exposed: - logger.info("No models mapped to exposure") - - # Extract creator info - if "creator" in exposure: - creator_email = exposure["creator"]["email"] - creator_name = exposure["creator"]["common_name"] - elif "creator_id" in exposure: - # If a metabase user is deactivated, the API returns a 404 - try: - creator = self.client.api( - "get", f"/api/user/{exposure['creator_id']}" - ) - except requests.exceptions.HTTPError as error: - creator = {} - if error.response is None or error.response.status_code != 404: - raise - - creator_name = creator.get("common_name") - creator_email = creator.get("email") - - exposure_label = exposure_name - # Only letters, numbers and underscores allowed in model names in dbt docs DAG / no duplicate model names - exposure_name = safe_name(exposure_name) - enumer = 1 - while exposure_name in documented_exposure_names: - exposure_name = f"{exposure_name}_{enumer}" - enumer += 1 - - # Construct exposure - parsed_exposures.append( - { - "id": item["id"], - "type": item["model"], - "collection": collection, - "exposure": self._build_exposure( - exposure_type=exposure_type, - exposure_id=exposure_id, - name=exposure_name, - label=exposure_label, - header=header or "", - created_at=exposure["created_at"], - creator_name=creator_name or "", - creator_email=creator_email or "", - description=exposure.get("description", ""), - native_query=native_query, - ), - } - ) - - documented_exposure_names.append(exposure_name) - - for group, exposures in self._group_exposures(parsed_exposures).items(): - path = self.output_path.joinpath(*group[:-1]) / f"{group[-1]}.yml" - path.parent.mkdir(parents=True, exist_ok=True) - - exposures_unwrapped = map(lambda x: x["exposure"], exposures) - exposures_sorted = sorted(exposures_unwrapped, key=lambda x: x["name"]) - - with open(path, "w", encoding="utf-8") as f: - yaml.dump( - { - "version": self._RESOURCE_VERSION, - "exposures": exposures_sorted, - }, - f, - Dumper=self.DbtDumper, - default_flow_style=False, - allow_unicode=True, - sort_keys=False, - ) - - return {"exposures": parsed_exposures} # todo: decide on output? - - def _extract_card_exposures( - self, - card_id: int, - exposure: Optional[Mapping] = None, - ): - """Extracts exposures from Metabase questions populating `self.models_exposed` - - Arguments: - card_id {int} -- Id of Metabase question used to pull question from api - - Keyword Arguments: - exposure {str} -- JSON api response from a question in Metabase, allows us to use the object if already in memory - - Returns: - None -- self.models_exposed is populated through this method. - """ - - # If an exposure is not passed, pull from id - if not exposure: - exposure = self.client.api("get", f"/api/card/{card_id}") - - query = exposure.get("dataset_query", {}) - - if query.get("type") == "query": - # Metabase GUI derived query - source_table_id = query.get("query", {}).get( - "source-table", exposure.get("table_id") - ) - - if str(source_table_id).startswith("card__"): - # Handle questions based on other question in virtual db - self._extract_card_exposures(int(source_table_id.split("__")[-1])) - else: - # Normal question - source_table = self.table_names.get(source_table_id) - if source_table: - logger.info( - "Model extracted from Metabase question: %s", - source_table, - ) - self.models_exposed.append(source_table) - - # Find models exposed through joins - for query_join in query.get("query", {}).get("joins", []): - # Handle questions based on other question in virtual db - if str(query_join.get("source-table", "")).startswith("card__"): - self._extract_card_exposures( - int(query_join.get("source-table").split("__")[-1]) - ) - continue - - # Joined model parsed - joined_table = self.table_names.get(query_join.get("source-table")) - if joined_table: - logger.info( - "Model extracted from Metabase question join: %s", - joined_table, - ) - self.models_exposed.append(joined_table) - - elif query.get("type") == "native": - # Metabase native query - native_query = query["native"].get("query") - ctes: List[str] = [] - - # Parse common table expressions for exclusion - for matched_cte in re.findall(self._CTE_PARSER, native_query): - ctes.extend(group.upper() for group in matched_cte if group) - - # Parse SQL for exposures through FROM or JOIN clauses - for sql_ref in re.findall(self._EXPOSURE_PARSER, native_query): - # Grab just the table / model name - clean_exposure = sql_ref.split(".")[-1].strip('"').upper() - - # Scrub CTEs (qualified sql_refs can not reference CTEs) - if clean_exposure in ctes and "." not in sql_ref: - continue - # Verify this is one of our parsed refable models so exposures dont break the DAG - if not self.model_refs.get(clean_exposure): - continue - - if clean_exposure: - logger.info( - "Model extracted from native query: %s", - clean_exposure, - ) - self.models_exposed.append(clean_exposure) - self.native_query = native_query - - def _build_exposure( - self, - exposure_type: str, - exposure_id: int, - name: str, - label: str, - header: str, - created_at: str, - creator_name: str, - creator_email: str, - description: str = "", - native_query: str = "", - ) -> Mapping: - """Builds an exposure object representation as defined here: https://docs.getdbt.com/reference/exposure-properties - - Arguments: - exposure_type {str} -- Model type in Metabase being either `card` or `dashboard` - exposure_id {str} -- Card or Dashboard id in Metabase - name {str} -- Name of exposure - label {str} -- Title of the card or dashboard in Metabase - header {str} -- The header goes at the top of the description and is useful for prefixing metadata - created_at {str} -- Timestamp of exposure creation derived from Metabase - creator_name {str} -- Creator name derived from Metabase - creator_email {str} -- Creator email derived from Metabase - - Keyword Arguments: - description {str} -- The description of the exposure as documented in Metabase. (default: No description provided in Metabase) - native_query {str} -- If exposure contains SQL, this arg will include the SQL in the dbt exposure documentation. (default: {""}) - - Returns: - Mapping -- JSON object representation of single exposure. - """ - - # Ensure model type is compatible - assert exposure_type in ( - "card", - "dashboard", - ), "Cannot construct exposure for object type of {}".format(exposure_type) - - if native_query: - # Format query into markdown code block - native_query = "#### Query\n\n```\n{}\n```\n\n".format( - "\n".join( - sql_line - for sql_line in self.native_query.strip().split("\n") - if sql_line.strip() != "" - ) - ) - - if not description: - description = "No description provided in Metabase\n\n" - - # Format metadata as markdown - metadata = ( - "#### Metadata\n\n" - + "Metabase Id: __{}__\n\n".format(exposure_id) - + "Created On: __{}__".format(created_at) - ) - - # Build description - description = ( - header + ("{}\n\n".format(description.strip())) + native_query + metadata - ) - - # Output exposure - return { - "name": name, - "label": label, - "description": safe_description(description), - "type": "analysis" if exposure_type == "card" else "dashboard", - "url": f"{self.client.url}/{exposure_type}/{exposure_id}", - "maturity": "medium", - "owner": { - "name": creator_name, - "email": creator_email, - }, - "depends_on": list( - { - self.model_refs[exposure.upper()] - for exposure in list({m for m in self.models_exposed}) - if exposure.upper() in self.model_refs - } - ), - } - - def _group_exposures( - self, exposures: Iterable[Mapping] - ) -> Mapping[Tuple[str, ...], Iterable[Mapping]]: - """Group exposures by configured output grouping. - - Args: - exposures (Iterable[Mapping]): Collection of exposures. - - Returns: - Mapping[Tuple[str, ...], Iterable[Mapping]]: Exposures indexed by configured grouping. - """ - - results: Dict[Tuple[str, ...], List[Mapping]] = {} - - for exposure in exposures: - group: Tuple[str, ...] = ("exposures",) - if self.output_grouping == "collection": - collection = exposure["collection"] - group = (collection.get("slug") or safe_name(collection["name"]),) - elif self.output_grouping == "type": - group = (exposure["type"], exposure["id"]) - - result = results.get(group, []) - result.append(exposure) - if group not in results: - results[group] = result - - return results - - -class MetabaseClient: - """Metabase API client.""" - - def __init__( - self, - url: str, - username: Optional[str] = None, - password: Optional[str] = None, - session_id: Optional[str] = None, - verify: bool = True, - cert: Optional[Union[str, Tuple[str, str]]] = None, - http_timeout: int = 15, - http_headers: Optional[dict] = None, - http_adapter: Optional[HTTPAdapter] = None, - ): - """New Metabase client. - - Args: - url (str): Metabase URL, e.g. "https://metabase.example.com". - username (Optional[str], optional): Metabase username (required unless providing session_id). Defaults to None. - password (Optional[str], optional): Metabase password (required unless providing session_id). Defaults to None. - session_id (Optional[str], optional): Metabase session ID. Defaults to None. - verify (bool, optional): Verify the TLS certificate at the Metabase end. Defaults to True. - cert (Optional[Union[str, Tuple[str, str]]], optional): Path to a custom certificate. Defaults to None. - http_timeout (int, optional): HTTP request timeout in secs. Defaults to 15. - http_headers (Optional[dict], optional): Additional HTTP headers. Defaults to None. - http_adapter (Optional[HTTPAdapter], optional): Custom requests HTTP adapter. Defaults to None. - """ - - self.url = url.rstrip("/") - - self.http_timeout = http_timeout - - self.session = requests.Session() - self.session.verify = verify - self.session.cert = cert - - if http_headers: - self.session.headers.update(http_headers) - - self.session.mount( - self.url, - http_adapter or HTTPAdapter(max_retries=Retry(total=3, backoff_factor=1)), - ) - - if not session_id: - if username and password: - session = self.api( - "post", - "/api/session", - json={"username": username, "password": password}, - ) - session_id = str(session["id"]) - else: - raise MetabaseArgumentError("Credentials or session ID required") - self.session.headers["X-Metabase-Session"] = session_id - - logger.info("Session established successfully") - - def api( - self, - method: str, - path: str, - critical: bool = True, - **kwargs, - ) -> Mapping: - """Unified way of calling Metabase API. - - Args: - method (str): HTTP verb, e.g. get, post, put. - path (str): Relative path of endpoint, e.g. /api/database. - critical (bool, optional): Raise on any HTTP errors. Defaults to True. - - Returns: - Mapping: JSON payload of the endpoint. - """ - - response = self.session.request( - method, - f"{self.url}{path}", - timeout=self.http_timeout, - **kwargs, - ) - - try: - response.raise_for_status() - except requests.exceptions.HTTPError: - if critical: - logger.error("HTTP request failed: %s", response.text) - raise - return {} - - response_json = response.json() - if "data" in response_json: - # Since X.40.0 responses are encapsulated in "data" with pagination parameters - return response_json["data"] - - return response_json - - def export_models( - self, - database: str, - models: List[MetabaseModel], - exclude_sources: bool = False, - sync_timeout: int = 30, - ): - """Exports dbt models to Metabase database schema. - - Args: - database (str): Metabase database name. - models (List[MetabaseModel]): List of dbt models read from project. - exclude_sources (bool, optional): Exclude dbt sources from export. Defaults to False. - """ - _ExportModelsJob( - client=self, - database=database, - models=models, - exclude_sources=exclude_sources, - sync_timeout=sync_timeout, - ).execute() - - def extract_exposures( - self, - models: List[MetabaseModel], - output_path: str = ".", - output_grouping: Optional[str] = None, - include_personal_collections: bool = True, - collection_includes: Optional[Iterable] = None, - collection_excludes: Optional[Iterable] = None, - ) -> Mapping: - """Extracts exposures in Metabase downstream of dbt models and sources as parsed by dbt reader. - - Args: - models (List[MetabaseModel]): List of dbt models. - output_path (str, optional): Path for output files. Defaults to ".". - output_grouping (Optional[str], optional): Grouping for output YAML files, supported values: "collection" (by collection slug) or "type" (by entity type). Defaults to None. - include_personal_collections (bool, optional): Include personal Metabase collections. Defaults to True. - collection_includes (Optional[Iterable], optional): Include certain Metabase collections. Defaults to None. - collection_excludes (Optional[Iterable], optional): Exclude certain Metabase collections. Defaults to None. - - Returns: - Mapping: _description_ - """ - return _ExtractExposuresJob( - client=self, - models=models, - output_path=output_path, - output_grouping=output_grouping, - include_personal_collections=include_personal_collections, - collection_includes=collection_includes, - collection_excludes=collection_excludes, - ).execute() diff --git a/sandbox/entrypoint.py b/sandbox/entrypoint.py index 882bf712..96e3cf84 100755 --- a/sandbox/entrypoint.py +++ b/sandbox/entrypoint.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +import time import requests from molot import envarg, envarg_int, evaluate, shell, target @@ -16,10 +17,24 @@ MB_NAME = envarg("MB_NAME", "dbtmetabase") +@target( + description="initial setup", + depends=["metabase_setup", "dbt_run", "metabase_content"], +) +def init(): + pass + + +@target(description="run dbt project") +def dbt_run(): + shell("dbt seed --profiles-dir .") + shell("dbt run --profiles-dir .") + + @target(description="set up Metabase user and database") -def setup_metabase(): +def metabase_setup(): requests.post( - f"http://{MB_HOST}:{MB_PORT}/api/setup", + url=f"http://{MB_HOST}:{MB_PORT}/api/setup", json={ "token": MB_SETUP_TOKEN, "user": { @@ -62,15 +77,135 @@ def setup_metabase(): ).raise_for_status() -@target(description="run dbt project") -def run_dbt(): - shell("dbt seed --profiles-dir .") - shell("dbt run --profiles-dir .") +@target(description="add mock content to Metabase") +def metabase_content(): + session_id = requests.post( + url=f"http://{MB_HOST}:{MB_PORT}/api/session", + json={"username": MB_USER, "password": MB_PASSWORD}, + timeout=10, + ).json()["id"] + headers = {"X-Metabase-Session": session_id} -@target(description="initial setup", depends=["setup_metabase", "run_dbt"]) -def init(): - pass + database_id = "" + databases = requests.get( + url=f"http://{MB_HOST}:{MB_PORT}/api/database", + headers=headers, + json={}, + timeout=10, + ).json()["data"] + for db in databases: + if db["name"] == POSTGRES_DB: + database_id = db["id"] + break + + requests.post( + url=f"http://{MB_HOST}:{MB_PORT}/api/database/{database_id}/sync_schema", + headers=headers, + json={}, + timeout=10, + ) + + time.sleep(5) + + tables_fields = requests.get( + url=f"http://{MB_HOST}:{MB_PORT}/api/database/{database_id}?include=tables.fields", + headers=headers, + timeout=10, + ).json() + + customers_table_id = "" + first_order_field_id = "" + for table in tables_fields["tables"]: + if table["name"] == "customers": + customers_table_id = table["id"] + for field in table["fields"]: + if field["name"] == "first_order": + first_order_field_id = field["id"] + break + + requests.post( + url=f"http://{MB_HOST}:{MB_PORT}/api/card", + headers=headers, + json={ + "name": "Customers", + "dataset_query": { + "database": database_id, + "type": "query", + "query": { + "source-table": customers_table_id, + "aggregation": [["count"]], + "breakout": [ + [ + "field", + first_order_field_id, + {"base-type": "type/Date", "temporal-unit": "month"}, + ] + ], + }, + }, + "display": "line", + "description": "Customers test", + "visualization_settings": { + "graph.dimensions": ["first_order"], + "graph.metrics": ["count"], + }, + "collection_id": None, + "collection_position": None, + "result_metadata": [ + { + "description": None, + "semantic_type": None, + "coercion_strategy": None, + "unit": "month", + "name": "first_order", + "settings": None, + "fk_target_field_id": None, + "field_ref": [ + "field", + first_order_field_id, + {"base-type": "type/Date", "temporal-unit": "month"}, + ], + "effective_type": "type/DateTimeWithLocalTZ", + "id": first_order_field_id, + "visibility_type": "normal", + "display_name": "First Order", + "fingerprint": { + "global": {"distinct-count": 47, "nil%": 0.38}, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07", + } + }, + }, + "base_type": "type/DateTimeWithLocalTZ", + }, + { + "display_name": "Count", + "semantic_type": "type/Quantity", + "field_ref": ["aggregation", 0], + "name": "count", + "base_type": "type/BigInteger", + "effective_type": "type/BigInteger", + "fingerprint": { + "global": {"distinct-count": 4, "nil%": 0}, + "type": { + "type/Number": { + "min": 2, + "q1": 11.298221281347036, + "q3": 27.5, + "max": 38, + "sd": 12.96148139681572, + "avg": 20, + } + }, + }, + }, + ], + }, + timeout=10, + ) evaluate() diff --git a/tests/__init__.py b/tests/__init__.py index 0b173941..02f3c091 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,2 +1,9 @@ -from .test_dbt import * -from .test_metabase import * +import logging + +from dbtmetabase._format import setup_logging + +from .test_core_exposures import * +from .test_core_models import * +from .test_manifest import * + +setup_logging(level=logging.DEBUG, path=None) diff --git a/tests/_mocks.py b/tests/_mocks.py new file mode 100644 index 00000000..f65a7b02 --- /dev/null +++ b/tests/_mocks.py @@ -0,0 +1,538 @@ +from __future__ import annotations + +import json +from pathlib import Path +from typing import Any, Dict, Iterable, Mapping, Optional + +from dbtmetabase._format import NullValue +from dbtmetabase.core import DbtMetabase +from dbtmetabase.manifest import Column, Group, Model + +FIXTURES_PATH = Path("tests") / "fixtures" +TMP_PATH = Path("tests") / "tmp" + + +class MockCore(DbtMetabase): + def __init__(self): + super().__init__( + manifest_path=Path("tests") / "fixtures" / "manifest.json", + metabase_url="http://localhost:3000", + metabase_session_id="dummy", + ) + + def read_models(self) -> Iterable[Model]: + return MANIFEST_MODELS + + def metabase_api( + self, + method: str, + path: str, + params: Optional[Dict[str, Any]] = None, + critical: bool = True, + **kwargs, + ) -> Mapping: + path_toks = f"{path.lstrip('/')}.json".split("/") + if path_toks[0] == "api" and method == "get": + json_path = Path.joinpath(FIXTURES_PATH, *path_toks) + if json_path.exists(): + with open(json_path, encoding="utf-8") as f: + return json.load(f) + return {} + + +MANIFEST_MODELS = [ + Model( + database="TEST", + schema="PUBLIC", + group=Group.nodes, + name="orders", + description="This table has basic information about orders, as well as some derived facts based on payments", + unique_id="model.jaffle_shop.orders", + source=None, + tags=[], + columns=[ + Column( + name="ORDER_ID", + description="This is a unique identifier for an order", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="CUSTOMER_ID", + description="Foreign key to the customers table", + meta_fields={}, + semantic_type="type/FK", + visibility_type=None, + fk_target_table="PUBLIC.CUSTOMERS", + fk_target_field="CUSTOMER_ID", + ), + Column( + name="ORDER_DATE", + description="Date (UTC) that the order was placed", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="STATUS", + description="Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="AMOUNT", + description="Total amount (AUD) of the order", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="CREDIT_CARD_AMOUNT", + description="Amount of the order (AUD) paid for by credit card", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="COUPON_AMOUNT", + description="Amount of the order (AUD) paid for by coupon", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="BANK_TRANSFER_AMOUNT", + description="Amount of the order (AUD) paid for by bank transfer", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="GIFT_CARD_AMOUNT", + description="Amount of the order (AUD) paid for by gift card", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + ], + ), + Model( + database="TEST", + schema="PUBLIC", + group=Group.nodes, + name="customers", + description="This table has basic information about a customer, as well as some derived facts based on a customer's orders", + unique_id="model.jaffle_shop.customers", + source=None, + tags=[], + columns=[ + Column( + name="CUSTOMER_ID", + description="This is a unique identifier for a customer", + meta_fields={}, + semantic_type=None, # This is a PK field, should not be detected as FK + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="FIRST_NAME", + description="Customer's first name. PII.", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="LAST_NAME", + description="Customer's last name. PII.", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="FIRST_ORDER", + description="Date (UTC) of a customer's first order", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="MOST_RECENT_ORDER", + description="Date (UTC) of a customer's most recent order", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="NUMBER_OF_ORDERS", + description="Count of the number of orders a customer has placed", + meta_fields={}, + semantic_type=NullValue, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="CUSTOMER_LIFETIME_VALUE", + description="Total value (AUD) of a customer's orders", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + ], + ), + Model( + database="TEST", + schema="PUBLIC", + group=Group.nodes, + name="stg_orders", + description="", + unique_id="model.jaffle_shop.stg_orders", + source=None, + tags=[], + columns=[ + Column( + name="ORDER_ID", + description="", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="STATUS", + description="", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + ], + ), + Model( + database="TEST", + schema="PUBLIC", + group=Group.nodes, + name="stg_payments", + description="", + unique_id="model.jaffle_shop.stg_payments", + source=None, + tags=[], + columns=[ + Column( + name="PAYMENT_ID", + description="", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + Column( + name="PAYMENT_METHOD", + description="", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ), + ], + ), + Model( + database="TEST", + schema="PUBLIC", + group=Group.nodes, + name="stg_customers", + description="", + unique_id="model.jaffle_shop.stg_customers", + source=None, + tags=[], + columns=[ + Column( + name="CUSTOMER_ID", + description="", + meta_fields={}, + semantic_type=None, + visibility_type=None, + fk_target_table=None, + fk_target_field=None, + ) + ], + ), +] + + +# MODELS = [ +# Model( +# database="TEST", +# schema="PUBLIC", +# group=Group.nodes, +# name="orders", +# description="This table has basic information about orders, as well as some derived facts based on payments", +# unique_id="model.jaffle_shop.orders", +# tags=[], +# columns=[ +# Column( +# name="ORDER_ID", +# description="This is a unique identifier for an order", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="CUSTOMER_ID", +# description="Foreign key to the customers table", +# meta_fields={}, +# semantic_type="type/FK", +# visibility_type=None, +# fk_target_table="PUBLIC.CUSTOMERS", +# fk_target_field="CUSTOMER_ID", +# ), +# Column( +# name="ORDER_DATE", +# description="Date (UTC) that the order was placed", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="STATUS", +# description="Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="AMOUNT", +# description="Total amount (AUD) of the order", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="CREDIT_CARD_AMOUNT", +# description="Amount of the order (AUD) paid for by credit card", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="COUPON_AMOUNT", +# description="Amount of the order (AUD) paid for by coupon", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="BANK_TRANSFER_AMOUNT", +# description="Amount of the order (AUD) paid for by bank transfer", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="GIFT_CARD_AMOUNT", +# description="Amount of the order (AUD) paid for by gift card", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# ], +# ), +# Model( +# database="TEST", +# schema="PUBLIC", +# group=Group.nodes, +# name="customers", +# description="This table has basic information about a customer, as well as some derived facts based on a customer's orders", +# unique_id="model.jaffle_shop.customers", +# tags=[], +# columns=[ +# Column( +# name="CUSTOMER_ID", +# description="This is a unique identifier for a customer", +# meta_fields={}, +# semantic_type="type/FK", +# visibility_type=None, +# fk_target_table="PUBLIC.orders", +# fk_target_field="CUSTOMER_ID", +# ), +# Column( +# name="FIRST_NAME", +# description="Customer's first name. PII.", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="LAST_NAME", +# description="Customer's last name. PII.", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="FIRST_ORDER", +# description="Date (UTC) of a customer's first order", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="MOST_RECENT_ORDER", +# description="Date (UTC) of a customer's most recent order", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="NUMBER_OF_ORDERS", +# description="Count of the number of orders a customer has placed", +# meta_fields={"display_name": "order_count"}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="CUSTOMER_LIFETIME_VALUE", +# description="Total value (AUD) of a customer's orders", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# ], +# ), +# Model( +# database="TEST", +# schema="PUBLIC", +# group=Group.nodes, +# name="stg_orders", +# description="", +# tags=[], +# columns=[ +# Column( +# name="ORDER_ID", +# description="", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="STATUS", +# description="", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# ], +# ), +# Model( +# database="TEST", +# schema="PUBLIC", +# group=Group.nodes, +# name="stg_payments", +# description="", +# tags=[], +# columns=[ +# Column( +# name="PAYMENT_ID", +# description="", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# Column( +# name="PAYMENT_METHOD", +# description="", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ), +# ], +# ), +# Model( +# database="TEST", +# schema="PUBLIC", +# group=Group.nodes, +# name="stg_customers", +# description="", +# tags=[], +# columns=[ +# Column( +# name="CUSTOMER_ID", +# description="", +# meta_fields={}, +# semantic_type=None, +# visibility_type=None, +# fk_target_table=None, +# fk_target_field=None, +# ) +# ], +# ), +# ] diff --git a/tests/fixtures/api/card.json b/tests/fixtures/api/card.json new file mode 100644 index 00000000..d98330e8 --- /dev/null +++ b/tests/fixtures/api/card.json @@ -0,0 +1,2497 @@ +[ + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 40.10050506338833, + "max": 131.0, + "sd": 26.119172295224672, + "avg": 32.15384615384615 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 34, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.17157287525381, + "q3": 34.732050807568875, + "max": 99.0, + "sd": 17.628392521514144, + "avg": 26.39102564102564 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.456526Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 9, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.208516Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.189846Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 33, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 17.0, + "q3": 55.93725393319377, + "max": 129.0, + "sd": 25.492672054973276, + "avg": 36.34782608695652 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 33.53589838486224, + "max": 65.0, + "sd": 17.057530000270994, + "avg": 27.342391304347824 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.665585Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 11, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.544961Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.52841Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.000946Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 42, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 4, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.545719Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:37.535187Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.157282Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 39, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 5, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.641827Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:37.630969Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "name": "customer_lifetime_value", + "field_ref": [ + "field", + 41, + { + "binning": { + "strategy": "num-bins", + "min-value": 0.0, + "max-value": 100.0, + "num-bins": 8, + "bin-width": 12.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 41, + "display_name": "customer_lifetime_value", + "fingerprint": { + "global": { + "distinct-count": 36, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.464101615137753, + "q3": 35.46410161513776, + "max": 99.0, + "sd": 18.812245525263663, + "avg": 26.967741935483872 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 3.0, + "q3": 17.5, + "max": 38.0, + "sd": 12.294017127971522, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by customer_lifetime_value", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.20895Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 41, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 7, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.870294Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "customer_lifetime_value" + ], + "graph.colors": [ + "#A6E7F3" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:37.858387Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": "type/Quantity", + "coercion_strategy": null, + "name": "number_of_orders", + "field_ref": [ + "field", + 40, + { + "binning": { + "strategy": "num-bins", + "min-value": 1.0, + "max-value": 5.0, + "num-bins": 8, + "bin-width": 0.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 40, + "display_name": "number_of_orders", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.0901356485315583, + "max": 5.0, + "sd": 0.7779687173818424, + "avg": 1.596774193548387 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 4.0, + "q3": 34.25, + "max": 38.0, + "sd": 16.492422502470642, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by number_of_orders", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.107313Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 40, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 6, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.76733Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "number_of_orders" + ], + "graph.colors": [ + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:37.754606Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 7, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0200644129064447, + "q3": 2.3725029928215275, + "max": 7.0, + "sd": 1.25650644505132, + "avg": 1.9038461538461537 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.019031639883796, + "max": 5.0, + "sd": 0.7594097162561813, + "avg": 1.573717948717949 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": null, + "query_type": "query", + "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", + "creator_id": 1, + "updated_at": "2021-07-21T19:19:58.848286Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 1, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:00:47.4892Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": null, + "favorite": false, + "created_at": "2021-07-21T08:00:47.453351Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.1073874870150486, + "q3": 3.0, + "max": 5.0, + "sd": 1.2643380578934107, + "avg": 2.152173913043478 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.019470273980893, + "q3": 1.989426104361334, + "max": 5.0, + "sd": 0.7515349295958083, + "avg": 1.596014492753623 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.321381Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 10, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.368218Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.347535Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 7, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0200644129064447, + "q3": 2.3725029928215275, + "max": 7.0, + "sd": 1.25650644505132, + "avg": 1.9038461538461537 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.019031639883796, + "max": 5.0, + "sd": 0.7594097162561813, + "avg": 1.573717948717949 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.368004Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 8, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.030503Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.016244Z", + "public_uuid": null + }, + { + "description": "Nice KPI", + "archived": false, + "collection_position": null, + "table_id": 6, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 99, + "q1": 99, + "q3": 99, + "max": 99, + "sd": null, + "avg": 99 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": null, + "query_type": "query", + "name": "Orders, Count", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:14.290572Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 6, + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 2, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:14.3056Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "Number of orders" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": null, + "favorite": false, + "created_at": "2021-07-21T08:01:14.290572Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 15.782357300628025, + "max": 38.0, + "sd": 10.488088481701515, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.346492Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 12, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.676704Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.662485Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 11.757359312880714, + "max": 38.0, + "sd": 10.528871870107588, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.483723Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 13, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.821564Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.808186Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.298221281347036, + "q3": 27.5, + "max": 38.0, + "sd": 12.96148139681572, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.52292Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 15, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.098141Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:39.084258Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 10.25, + "q3": 30.5, + "max": 38.0, + "sd": 12.62933094031509, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.562877Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 14, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.953633Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:38.938688Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.0, + "q3": 54.5, + "max": 60.0, + "sd": 29.280255007997, + "avg": 33.333333333333336 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.603496Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 17, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.385031Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:39.371067Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 15.5, + "q3": 50.0, + "max": 54.0, + "sd": 23.35237318418266, + "avg": 33.333333333333336 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.567707Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 16, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.243522Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:39.228965Z", + "public_uuid": null + }, + { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 100.0, + "q1": 100.0, + "q3": 100.0, + "max": 100.0, + "sd": null, + "avg": 100.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Total customers", + "creator_id": 1, + "updated_at": "2021-07-21T08:01:41.996Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 3, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.449936Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "favorite": false, + "created_at": "2021-07-21T08:01:37.434243Z", + "public_uuid": null + } +] \ No newline at end of file diff --git a/tests/fixtures/api/card/1.json b/tests/fixtures/api/card/1.json new file mode 100644 index 00000000..b1042b72 --- /dev/null +++ b/tests/fixtures/api/card/1.json @@ -0,0 +1,175 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 7, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0200644129064447, + "q3": 2.3725029928215275, + "max": 7.0, + "sd": 1.25650644505132, + "avg": 1.9038461538461537 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.019031639883796, + "max": 5.0, + "sd": 0.7594097162561813, + "avg": 1.573717948717949 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": null, + "query_type": "query", + "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", + "dashboard_count": 0, + "creator_id": 1, + "updated_at": "2021-07-21T19:19:58.848286Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 1, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:00:47.4892Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": null, + "created_at": "2021-07-21T08:00:47.453351Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/10.json b/tests/fixtures/api/card/10.json new file mode 100644 index 00000000..ca68fd26 --- /dev/null +++ b/tests/fixtures/api/card/10.json @@ -0,0 +1,186 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.1073874870150486, + "q3": 3.0, + "max": 5.0, + "sd": 1.2643380578934107, + "avg": 2.152173913043478 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.019470273980893, + "q3": 1.989426104361334, + "max": 5.0, + "sd": 0.7515349295958083, + "avg": 1.596014492753623 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.321381Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 10, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.368218Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.347535Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/11.json b/tests/fixtures/api/card/11.json new file mode 100644 index 00000000..94126819 --- /dev/null +++ b/tests/fixtures/api/card/11.json @@ -0,0 +1,186 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 33, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 17.0, + "q3": 55.93725393319377, + "max": 129.0, + "sd": 25.492672054973276, + "avg": 36.34782608695652 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 33.53589838486224, + "max": 65.0, + "sd": 17.057530000270994, + "avg": 27.342391304347824 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.665585Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 11, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.544961Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.52841Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/12.json b/tests/fixtures/api/card/12.json new file mode 100644 index 00000000..71d73029 --- /dev/null +++ b/tests/fixtures/api/card/12.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 15.782357300628025, + "max": 38.0, + "sd": 10.488088481701515, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.346492Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 12, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.676704Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.662485Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/13.json b/tests/fixtures/api/card/13.json new file mode 100644 index 00000000..fd61f167 --- /dev/null +++ b/tests/fixtures/api/card/13.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 11.757359312880714, + "max": 38.0, + "sd": 10.528871870107588, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.483723Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 13, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.821564Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.808186Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/14.json b/tests/fixtures/api/card/14.json new file mode 100644 index 00000000..11745e92 --- /dev/null +++ b/tests/fixtures/api/card/14.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 10.25, + "q3": 30.5, + "max": 38.0, + "sd": 12.62933094031509, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.562877Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 14, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.953633Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.938688Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/15.json b/tests/fixtures/api/card/15.json new file mode 100644 index 00000000..c897c1f1 --- /dev/null +++ b/tests/fixtures/api/card/15.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.298221281347036, + "q3": 27.5, + "max": 38.0, + "sd": 12.96148139681572, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.52292Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 15, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.098141Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:39.084258Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/16.json b/tests/fixtures/api/card/16.json new file mode 100644 index 00000000..f7650d5f --- /dev/null +++ b/tests/fixtures/api/card/16.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 15.5, + "q3": 50.0, + "max": 54.0, + "sd": 23.35237318418266, + "avg": 33.333333333333336 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.567707Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 16, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.243522Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:39.228965Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/17.json b/tests/fixtures/api/card/17.json new file mode 100644 index 00000000..2cabb0f4 --- /dev/null +++ b/tests/fixtures/api/card/17.json @@ -0,0 +1,145 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.0, + "q3": 54.5, + "max": 60.0, + "sd": 29.280255007997, + "avg": 33.333333333333336 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.603496Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 17, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.385031Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:39.371067Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/2.json b/tests/fixtures/api/card/2.json new file mode 100644 index 00000000..68f22a14 --- /dev/null +++ b/tests/fixtures/api/card/2.json @@ -0,0 +1,90 @@ +{ + "description": "Nice KPI", + "archived": false, + "collection_position": null, + "table_id": 6, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0 + }, + "type": { + "type/Number": { + "min": 99, + "q1": 99, + "q3": 99, + "max": 99, + "sd": null, + "avg": 99 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": null, + "query_type": "query", + "name": "Orders, Count", + "dashboard_count": 0, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:14.290572Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 6, + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 2, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:14.3056Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "Number of orders" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": null, + "created_at": "2021-07-21T08:01:14.290572Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/3.json b/tests/fixtures/api/card/3.json new file mode 100644 index 00000000..dfd0762a --- /dev/null +++ b/tests/fixtures/api/card/3.json @@ -0,0 +1,90 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 100.0, + "q1": 100.0, + "q3": 100.0, + "max": 100.0, + "sd": null, + "avg": 100.0 + } + } + } + } + ], + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Total customers", + "dashboard_count": 1, + "creator_id": 2, + "updated_at": "2021-07-21T08:01:41.996Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 3, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.449936Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:37.434243Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/4.json b/tests/fixtures/api/card/4.json new file mode 100644 index 00000000..c700bfca --- /dev/null +++ b/tests/fixtures/api/card/4.json @@ -0,0 +1,111 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.000946Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 42, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 4, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.545719Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:37.535187Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/5.json b/tests/fixtures/api/card/5.json new file mode 100644 index 00000000..90e70f31 --- /dev/null +++ b/tests/fixtures/api/card/5.json @@ -0,0 +1,111 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.157282Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 39, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 5, + "display": "scalar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.641827Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:37.630969Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/6.json b/tests/fixtures/api/card/6.json new file mode 100644 index 00000000..1cf9abc1 --- /dev/null +++ b/tests/fixtures/api/card/6.json @@ -0,0 +1,155 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": "type/Quantity", + "coercion_strategy": null, + "name": "number_of_orders", + "field_ref": [ + "field", + 40, + { + "binning": { + "strategy": "num-bins", + "min-value": 1.0, + "max-value": 5.0, + "num-bins": 8, + "bin-width": 0.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 40, + "display_name": "number_of_orders", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.0901356485315583, + "max": 5.0, + "sd": 0.7779687173818424, + "avg": 1.596774193548387 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 4.0, + "q3": 34.25, + "max": 38.0, + "sd": 16.492422502470642, + "avg": 20.0 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by number_of_orders", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.107313Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 40, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 6, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.76733Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "number_of_orders" + ], + "graph.colors": [ + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:37.754606Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/7.json b/tests/fixtures/api/card/7.json new file mode 100644 index 00000000..cd7e2e76 --- /dev/null +++ b/tests/fixtures/api/card/7.json @@ -0,0 +1,155 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "name": "customer_lifetime_value", + "field_ref": [ + "field", + 41, + { + "binning": { + "strategy": "num-bins", + "min-value": 0.0, + "max-value": 100.0, + "num-bins": 8, + "bin-width": 12.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 41, + "display_name": "customer_lifetime_value", + "fingerprint": { + "global": { + "distinct-count": 36, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.464101615137753, + "q3": 35.46410161513776, + "max": 99.0, + "sd": 18.812245525263663, + "avg": 26.967741935483872 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 3.0, + "q3": 17.5, + "max": 38.0, + "sd": 12.294017127971522, + "avg": 12.5 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by customer_lifetime_value", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.20895Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 41, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 7, + "display": "bar", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:37.870294Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "customer_lifetime_value" + ], + "graph.colors": [ + "#A6E7F3" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:37.858387Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/8.json b/tests/fixtures/api/card/8.json new file mode 100644 index 00000000..3b881ddf --- /dev/null +++ b/tests/fixtures/api/card/8.json @@ -0,0 +1,186 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 7, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0200644129064447, + "q3": 2.3725029928215275, + "max": 7.0, + "sd": 1.25650644505132, + "avg": 1.9038461538461537 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.019031639883796, + "max": 5.0, + "sd": 0.7594097162561813, + "avg": 1.573717948717949 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.368004Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 8, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.030503Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.016244Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/card/9.json b/tests/fixtures/api/card/9.json new file mode 100644 index 00000000..7d6f491a --- /dev/null +++ b/tests/fixtures/api/card/9.json @@ -0,0 +1,186 @@ +{ + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 40.10050506338833, + "max": 131.0, + "sd": 26.119172295224672, + "avg": 32.15384615384615 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 34, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.17157287525381, + "q3": 34.732050807568875, + "max": 99.0, + "sd": 17.628392521514144, + "avg": 26.39102564102564 + } + } + } + } + ], + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "can_write": true, + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "dashboard_count": 1, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.456526Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 9, + "display": "line", + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:38.208516Z" + }, + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "collection": { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + "created_at": "2021-07-21T08:01:38.189846Z", + "public_uuid": null +} \ No newline at end of file diff --git a/tests/fixtures/api/collection.json b/tests/fixtures/api/collection.json new file mode 100644 index 00000000..9c307a11 --- /dev/null +++ b/tests/fixtures/api/collection.json @@ -0,0 +1,49 @@ +[ + { + "name": "Our analytics", + "id": "root", + "parent_id": null, + "effective_location": null, + "effective_ancestors": [], + "can_write": true + }, + { + "authority_level": null, + "description": null, + "archived": false, + "slug": "dbtmetabase_s_personal_collection", + "color": "#31698A", + "can_write": true, + "name": "dbtmetabase's Personal Collection", + "personal_owner_id": 1, + "id": 1, + "location": "/", + "namespace": null + }, + { + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "can_write": true, + "name": "A look at your customers table", + "personal_owner_id": null, + "id": 3, + "location": "/2/", + "namespace": null + }, + { + "authority_level": null, + "description": null, + "archived": false, + "slug": "automatically_generated_dashboards", + "color": "#509EE3", + "can_write": true, + "name": "Automatically Generated Dashboards", + "personal_owner_id": null, + "id": 2, + "location": "/", + "namespace": null + } +] \ No newline at end of file diff --git a/tests/fixtures/api/collection/1.json b/tests/fixtures/api/collection/1.json new file mode 100644 index 00000000..4c517b08 --- /dev/null +++ b/tests/fixtures/api/collection/1.json @@ -0,0 +1,23 @@ +{ + "authority_level": null, + "description": null, + "archived": false, + "slug": "dbtmetabase_s_personal_collection", + "color": "#31698A", + "can_write": true, + "name": "dbtmetabase's Personal Collection", + "personal_owner_id": 1, + "effective_ancestors": [ + { + "metabase.models.collection.root/is-root?": true, + "name": "Our analytics", + "id": "root", + "can_write": true + } + ], + "effective_location": "/", + "parent_id": null, + "id": 1, + "location": "/", + "namespace": null +} \ No newline at end of file diff --git a/tests/fixtures/api/collection/2.json b/tests/fixtures/api/collection/2.json new file mode 100644 index 00000000..080a8402 --- /dev/null +++ b/tests/fixtures/api/collection/2.json @@ -0,0 +1,23 @@ +{ + "authority_level": null, + "description": null, + "archived": false, + "slug": "automatically_generated_dashboards", + "color": "#509EE3", + "can_write": true, + "name": "Automatically Generated Dashboards", + "personal_owner_id": null, + "effective_ancestors": [ + { + "metabase.models.collection.root/is-root?": true, + "name": "Our analytics", + "id": "root", + "can_write": true + } + ], + "effective_location": "/", + "parent_id": null, + "id": 2, + "location": "/", + "namespace": null +} \ No newline at end of file diff --git a/tests/fixtures/api/collection/2/items.json b/tests/fixtures/api/collection/2/items.json new file mode 100644 index 00000000..75a1f83e --- /dev/null +++ b/tests/fixtures/api/collection/2/items.json @@ -0,0 +1,9 @@ +[ + { + "description": "Automatically generated cards.", + "can_write": true, + "name": "A look at your customers table", + "id": 3, + "model": "collection" + } +] \ No newline at end of file diff --git a/tests/fixtures/api/collection/3.json b/tests/fixtures/api/collection/3.json new file mode 100644 index 00000000..243332d5 --- /dev/null +++ b/tests/fixtures/api/collection/3.json @@ -0,0 +1,28 @@ +{ + "authority_level": null, + "description": "Automatically generated cards.", + "archived": false, + "slug": "a_look_at_your_customers_table", + "color": "#f9d45c", + "can_write": true, + "name": "A look at your customers table", + "personal_owner_id": null, + "effective_ancestors": [ + { + "metabase.models.collection.root/is-root?": true, + "name": "Our analytics", + "id": "root", + "can_write": true + }, + { + "name": "Automatically Generated Dashboards", + "id": 2, + "can_write": true + } + ], + "effective_location": "/2/", + "parent_id": 2, + "id": 3, + "location": "/2/", + "namespace": null +} \ No newline at end of file diff --git a/tests/fixtures/api/collection/3/items.json b/tests/fixtures/api/collection/3/items.json new file mode 100644 index 00000000..523238c9 --- /dev/null +++ b/tests/fixtures/api/collection/3/items.json @@ -0,0 +1,257 @@ +[ + { + "description": null, + "collection_position": 1, + "name": "A look at your customers table", + "id": 1, + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:39.542335Z" + }, + "favorite": false, + "model": "dashboard" + }, + { + "description": null, + "collection_position": null, + "name": "Customer_lifetime_value over time", + "id": 11, + "display": "line", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.544961Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Customer_lifetime_value over time", + "id": 9, + "display": "line", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.208516Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Customers added in the last 30 days", + "id": 4, + "display": "scalar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:37.545719Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Customers added in the last 30 days", + "id": 5, + "display": "scalar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:37.641827Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Customers by customer_lifetime_value", + "id": 7, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:37.870294Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Customers by number_of_orders", + "id": 6, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:37.76733Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Number_of_orders over time", + "id": 8, + "display": "line", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.030503Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Number_of_orders over time", + "id": 10, + "display": "line", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.368218Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by day of the week", + "id": 12, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.676704Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by day of the week", + "id": 13, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.821564Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by month of the year", + "id": 15, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:39.098141Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by month of the year", + "id": 14, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:38.953633Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by quarter of the year", + "id": 17, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:39.385031Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Timestamp by quarter of the year", + "id": 16, + "display": "bar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:39.243522Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": null, + "collection_position": null, + "name": "Total customers", + "id": 3, + "display": "scalar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:37.449936Z" + }, + "favorite": false, + "model": "card" + } +] \ No newline at end of file diff --git a/tests/fixtures/api/collection/root/items.json b/tests/fixtures/api/collection/root/items.json new file mode 100644 index 00000000..6a54de1b --- /dev/null +++ b/tests/fixtures/api/collection/root/items.json @@ -0,0 +1,48 @@ +[ + { + "description": null, + "can_write": true, + "name": "dbtmetabase's Personal Collection", + "id": 1, + "model": "collection" + }, + { + "description": null, + "can_write": true, + "name": "Automatically Generated Dashboards", + "id": 2, + "model": "collection" + }, + { + "description": null, + "collection_position": null, + "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", + "id": 1, + "display": "line", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:00:47.4892Z" + }, + "favorite": false, + "model": "card" + }, + { + "description": "Nice KPI", + "collection_position": null, + "name": "Orders, Count", + "id": 2, + "display": "scalar", + "last-edit-info": { + "id": 1, + "last_name": "", + "first_name": "dbtmetabase", + "email": "user@example.com", + "timestamp": "2021-07-21T08:01:14.3056Z" + }, + "favorite": false, + "model": "card" + } +] \ No newline at end of file diff --git a/tests/fixtures/api/dashboard.json b/tests/fixtures/api/dashboard.json new file mode 100644 index 00000000..5c686e86 --- /dev/null +++ b/tests/fixtures/api/dashboard.json @@ -0,0 +1,54 @@ +[ + { + "description": null, + "archived": false, + "collection_position": 1, + "creator": { + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_login": "2021-07-21T19:25:28.6083Z", + "is_qbnewb": false, + "is_superuser": true, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase" + }, + "enable_embedding": false, + "collection_id": 3, + "show_in_getting_started": false, + "name": "A look at your customers table", + "caveats": null, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:37.328519Z", + "made_public_by_id": null, + "embedding_params": null, + "id": 1, + "position": null, + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.542335Z" + }, + "parameters": [ + { + "id": "-1693594175", + "type": "date/all-options", + "name": "most_recent_order", + "slug": "most_recent_order" + }, + { + "id": "381527929", + "type": "date/all-options", + "name": "first_order", + "slug": "first_order" + } + ], + "favorite": false, + "created_at": "2021-07-21T08:01:37.328519Z", + "public_uuid": null, + "points_of_interest": null + } +] \ No newline at end of file diff --git a/tests/fixtures/api/dashboard/1.json b/tests/fixtures/api/dashboard/1.json new file mode 100644 index 00000000..38c75def --- /dev/null +++ b/tests/fixtures/api/dashboard/1.json @@ -0,0 +1,2533 @@ +{ + "description": null, + "archived": false, + "collection_position": 1, + "ordered_cards": [ + { + "sizeX": 18, + "series": [], + "collection_authority_level": null, + "card": { + "query_average_duration": null + }, + "updated_at": "2021-07-21T08:01:37.372373Z", + "col": 0, + "id": 1, + "parameter_mappings": [], + "card_id": null, + "visualization_settings": { + "text": "# Summary", + "virtual_card": { + "name": null, + "display": "text", + "dataset_query": {}, + "visualization_settings": {} + }, + "dashcard.background": false, + "text.align_vertical": "bottom" + }, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.372373Z", + "sizeY": 2, + "row": 0 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 100.0, + "q1": 100.0, + "q3": 100.0, + "max": 100.0, + "sd": null, + "avg": 100.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Total customers", + "query_average_duration": 579, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:41.996Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 3, + "display": "scalar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "created_at": "2021-07-21T08:01:37.434243Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:37.466466Z", + "col": 0, + "id": 2, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 3 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 3 + } + ], + "card_id": 3, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.466466Z", + "sizeY": 4, + "row": 2 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "query_average_duration": 38, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.000946Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 42, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 4, + "display": "scalar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "created_at": "2021-07-21T08:01:37.535187Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:37.567169Z", + "col": 6, + "id": 3, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 4 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 4 + } + ], + "card_id": 4, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.567169Z", + "sizeY": 4, + "row": 2 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 1, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.0, + "max": 0.0, + "sd": null, + "avg": 0.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers added in the last 30 days", + "query_average_duration": 132, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.157282Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "filter": [ + "time-interval", + [ + "field", + 39, + null + ], + -30, + "day" + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 5, + "display": "scalar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [] + }, + "created_at": "2021-07-21T08:01:37.630969Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:37.652919Z", + "col": 12, + "id": 4, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 5 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 5 + } + ], + "card_id": 5, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.652919Z", + "sizeY": 4, + "row": 2 + }, + { + "sizeX": 18, + "series": [], + "collection_authority_level": null, + "card": { + "query_average_duration": null + }, + "updated_at": "2021-07-21T08:01:37.686857Z", + "col": 0, + "id": 5, + "parameter_mappings": [], + "card_id": null, + "visualization_settings": { + "text": "# How these customers are distributed", + "virtual_card": { + "name": null, + "display": "text", + "dataset_query": {}, + "visualization_settings": {} + }, + "dashcard.background": false, + "text.align_vertical": "bottom" + }, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.686857Z", + "sizeY": 2, + "row": 6 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": "type/Quantity", + "coercion_strategy": null, + "name": "number_of_orders", + "field_ref": [ + "field", + 40, + { + "binning": { + "strategy": "num-bins", + "min-value": 1.0, + "max-value": 5.0, + "num-bins": 8, + "bin-width": 0.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 40, + "display_name": "number_of_orders", + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.0901356485315583, + "max": 5.0, + "sd": 0.7779687173818424, + "avg": 1.596774193548387 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 4.0, + "q3": 34.25, + "max": 38.0, + "sd": 16.492422502470642, + "avg": 20.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by number_of_orders", + "query_average_duration": 321, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.107313Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 40, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 6, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "number_of_orders" + ], + "graph.colors": [ + "#EF8C8C" + ] + }, + "created_at": "2021-07-21T08:01:37.754606Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:37.781517Z", + "col": 0, + "id": 6, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 6 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 6 + } + ], + "card_id": 6, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.781517Z", + "sizeY": 4, + "row": 8 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "name": "customer_lifetime_value", + "field_ref": [ + "field", + 41, + { + "binning": { + "strategy": "num-bins", + "min-value": 0.0, + "max-value": 100.0, + "num-bins": 8, + "bin-width": 12.5 + } + } + ], + "effective_type": "type/BigInteger", + "id": 41, + "display_name": "customer_lifetime_value", + "fingerprint": { + "global": { + "distinct-count": 36, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.464101615137753, + "q3": 35.46410161513776, + "max": 99.0, + "sd": 18.812245525263663, + "avg": 26.967741935483872 + } + } + }, + "base_type": "type/Decimal" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 3.0, + "q3": 17.5, + "max": 38.0, + "sd": 12.294017127971522, + "avg": 12.5 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customers by customer_lifetime_value", + "query_average_duration": 163, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.20895Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 41, + { + "binning": { + "strategy": "default" + } + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 7, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "customer_lifetime_value" + ], + "graph.colors": [ + "#A6E7F3" + ] + }, + "created_at": "2021-07-21T08:01:37.858387Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:37.886739Z", + "col": 6, + "id": 7, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 7 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 7 + } + ], + "card_id": 7, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.886739Z", + "sizeY": 4, + "row": 8 + }, + { + "sizeX": 18, + "series": [], + "collection_authority_level": null, + "card": { + "query_average_duration": null + }, + "updated_at": "2021-07-21T08:01:37.923226Z", + "col": 0, + "id": 8, + "parameter_mappings": [], + "card_id": null, + "visualization_settings": { + "text": "# These customers across time", + "virtual_card": { + "name": null, + "display": "text", + "dataset_query": {}, + "visualization_settings": {} + }, + "dashcard.background": false, + "text.align_vertical": "bottom" + }, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:37.923226Z", + "sizeY": 2, + "row": 12 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 7, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0200644129064447, + "q3": 2.3725029928215275, + "max": 7.0, + "sd": 1.25650644505132, + "avg": 1.9038461538461537 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.019031639883796, + "max": 5.0, + "sd": 0.7594097162561813, + "avg": 1.573717948717949 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "query_average_duration": 1044, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.368004Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 8, + "display": "line", + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "created_at": "2021-07-21T08:01:38.016244Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.058235Z", + "col": 0, + "id": 9, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 8 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 8 + } + ], + "card_id": 8, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.058235Z", + "sizeY": 4, + "row": 14 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 40.10050506338833, + "max": 131.0, + "sd": 26.119172295224672, + "avg": 32.15384615384615 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 34, + "nil%": 0.01886792452830189 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.17157287525381, + "q3": 34.732050807568875, + "max": 99.0, + "sd": 17.628392521514144, + "avg": 26.39102564102564 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "query_average_duration": 1070, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.456526Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 9, + "display": "line", + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "created_at": "2021-07-21T08:01:38.189846Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.245167Z", + "col": 6, + "id": 10, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 9 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 9 + } + ], + "card_id": 9, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.245167Z", + "sizeY": 4, + "row": 14 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.1073874870150486, + "q3": 3.0, + "max": 5.0, + "sd": 1.2643380578934107, + "avg": 2.152173913043478 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of number_of_orders", + "base_type": "type/Decimal", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 8, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.019470273980893, + "q3": 1.989426104361334, + "max": 5.0, + "sd": 0.7515349295958083, + "avg": 1.596014492753623 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Number_of_orders over time", + "query_average_duration": 861, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.321381Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 40, + null + ] + ], + [ + "avg", + [ + "field", + 40, + null + ] + ] + ] + } + }, + "id": 10, + "display": "line", + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#7172AD", + "#EF8C8C" + ] + }, + "created_at": "2021-07-21T08:01:38.347535Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.41171Z", + "col": 12, + "id": 11, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 10 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 10 + } + ], + "card_id": 10, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.41171Z", + "sizeY": 4, + "row": 14 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Date" + }, + { + "name": "sum", + "display_name": "Sum of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 33, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 17.0, + "q3": 55.93725393319377, + "max": 129.0, + "sd": 25.492672054973276, + "avg": 36.34782608695652 + } + } + } + }, + { + "name": "avg", + "display_name": "Average of customer_lifetime_value", + "base_type": "type/Decimal", + "semantic_type": null, + "field_ref": [ + "aggregation", + 1 + ], + "fingerprint": { + "global": { + "distinct-count": 35, + "nil%": 0.02127659574468085 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 15.0, + "q3": 33.53589838486224, + "max": 65.0, + "sd": 17.057530000270994, + "avg": 27.342391304347824 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Customer_lifetime_value over time", + "query_average_duration": 843, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.665585Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "sum", + [ + "field", + 41, + null + ] + ], + [ + "avg", + [ + "field", + 41, + null + ] + ] + ] + } + }, + "id": 11, + "display": "line", + "visualization_settings": { + "graph.series_labels": [ + "sum", + "average" + ], + "graph.metrics": [ + "sum", + "avg" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#f9d45c", + "#F1B556" + ] + }, + "created_at": "2021-07-21T08:01:38.52841Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.575083Z", + "col": 0, + "id": 12, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 11 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 11 + } + ], + "card_id": 11, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.575083Z", + "sizeY": 4, + "row": 18 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 15.782357300628025, + "max": 38.0, + "sd": 10.488088481701515, + "avg": 12.5 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "query_average_duration": 277, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.346492Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 12, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:38.662485Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.705264Z", + "col": 6, + "id": 13, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 12 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 12 + } + ], + "card_id": 12, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.705264Z", + "sizeY": 4, + "row": 18 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "day-of-week", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 6, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 6.0, + "q1": 7.414213562373095, + "q3": 11.757359312880714, + "max": 38.0, + "sd": 10.528871870107588, + "avg": 12.5 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by day of the week", + "query_average_duration": 195, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.483723Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "day-of-week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 13, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:38.808186Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.850161Z", + "col": 12, + "id": 14, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 13 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 13 + } + ], + "card_id": 13, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.850161Z", + "sizeY": 4, + "row": 18 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 10.25, + "q3": 30.5, + "max": 38.0, + "sd": 12.62933094031509, + "avg": 20.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "query_average_duration": 159, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.562877Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 14, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:38.938688Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:38.983764Z", + "col": 0, + "id": 15, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 14 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 14 + } + ], + "card_id": 14, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:38.983764Z", + "sizeY": 4, + "row": 22 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "month-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.298221281347036, + "q3": 27.5, + "max": 38.0, + "sd": 12.96148139681572, + "avg": 20.0 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by month of the year", + "query_average_duration": 119, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.52292Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "month-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 15, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:39.084258Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:39.132463Z", + "col": 6, + "id": 16, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 15 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 15 + } + ], + "card_id": 15, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:39.132463Z", + "sizeY": 4, + "row": 22 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "most_recent_order", + "field_ref": [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 42, + "display_name": "most_recent_order", + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 8.0, + "q1": 15.5, + "q3": 50.0, + "max": 54.0, + "sd": 23.35237318418266, + "avg": 33.333333333333336 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "query_average_duration": 73, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.567707Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 42, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 16, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "most_recent_order" + ], + "graph.colors": [ + "#A6E7F3" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:39.228965Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:39.274309Z", + "col": 12, + "id": 17, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 16 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 16 + } + ], + "card_id": 16, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:39.274309Z", + "sizeY": 4, + "row": 22 + }, + { + "sizeX": 6, + "series": [], + "collection_authority_level": null, + "card": { + "description": null, + "archived": false, + "collection_position": null, + "table_id": 7, + "result_metadata": [ + { + "semantic_type": null, + "coercion_strategy": null, + "unit": "quarter-of-year", + "name": "first_order", + "field_ref": [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ], + "effective_type": "type/Date", + "id": 39, + "display_name": "first_order", + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "base_type": "type/Integer" + }, + { + "name": "count", + "display_name": "Count", + "base_type": "type/BigInteger", + "semantic_type": "type/Quantity", + "field_ref": [ + "aggregation", + 0 + ], + "fingerprint": { + "global": { + "distinct-count": 3, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 2.0, + "q1": 11.0, + "q3": 54.5, + "max": 60.0, + "sd": 29.280255007997, + "avg": 33.333333333333336 + } + } + } + } + ], + "database_id": 2, + "enable_embedding": false, + "collection_id": 3, + "query_type": "query", + "name": "Timestamp by quarter of the year", + "query_average_duration": 74, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:42.603496Z", + "made_public_by_id": null, + "embedding_params": null, + "cache_ttl": null, + "dataset_query": { + "type": "query", + "database": 2, + "query": { + "source-table": 7, + "breakout": [ + [ + "field", + 39, + { + "temporal-unit": "quarter-of-year" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + } + }, + "id": 17, + "display": "bar", + "visualization_settings": { + "graph.series_labels": [ + "number" + ], + "graph.metrics": [ + "count" + ], + "graph.dimensions": [ + "first_order" + ], + "graph.colors": [ + "#F1B556" + ], + "graph.x_axis.title_text": "Timestamp" + }, + "created_at": "2021-07-21T08:01:39.371067Z", + "public_uuid": null + }, + "updated_at": "2021-07-21T08:01:39.426126Z", + "col": 0, + "id": 18, + "parameter_mappings": [ + { + "parameter_id": "-1693594175", + "target": [ + "dimension", + [ + "field", + 42, + null + ] + ], + "card_id": 17 + }, + { + "parameter_id": "381527929", + "target": [ + "dimension", + [ + "field", + 39, + null + ] + ], + "card_id": 17 + } + ], + "card_id": 17, + "visualization_settings": {}, + "dashboard_id": 1, + "created_at": "2021-07-21T08:01:39.426126Z", + "sizeY": 4, + "row": 26 + } + ], + "param_values": null, + "can_write": true, + "enable_embedding": false, + "collection_id": 3, + "show_in_getting_started": false, + "name": "A look at your customers table", + "caveats": null, + "collection_authority_level": null, + "creator_id": 1, + "updated_at": "2021-07-21T08:01:37.328519Z", + "made_public_by_id": null, + "embedding_params": null, + "id": 1, + "position": null, + "param_fields": { + "42": { + "id": 42, + "table_id": 7, + "display_name": "most_recent_order", + "base_type": "type/Date", + "semantic_type": null, + "has_field_values": "none", + "name_field": null, + "dimensions": [] + }, + "39": { + "id": 39, + "table_id": 7, + "display_name": "first_order", + "base_type": "type/Date", + "semantic_type": null, + "has_field_values": "none", + "name_field": null, + "dimensions": [] + } + }, + "last-edit-info": { + "id": 1, + "email": "user@example.com", + "first_name": "dbtmetabase", + "last_name": "", + "timestamp": "2021-07-21T08:01:39.542335Z" + }, + "parameters": [ + { + "id": "-1693594175", + "type": "date/all-options", + "name": "most_recent_order", + "slug": "most_recent_order" + }, + { + "id": "381527929", + "type": "date/all-options", + "name": "first_order", + "slug": "first_order" + } + ], + "created_at": "2021-07-21T08:01:37.328519Z", + "public_uuid": null, + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/database.json b/tests/fixtures/api/database.json new file mode 100644 index 00000000..e7337673 --- /dev/null +++ b/tests/fixtures/api/database.json @@ -0,0 +1,51 @@ +[ + { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "native_permissions": "write", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + } +] \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/database/2.json b/tests/fixtures/api/database/2.json similarity index 99% rename from tests/fixtures/mock_api/api/database/2.json rename to tests/fixtures/api/database/2.json index 374ac2d5..95c2c8d4 100644 --- a/tests/fixtures/mock_api/api/database/2.json +++ b/tests/fixtures/api/database/2.json @@ -61,4 +61,4 @@ "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null -} +} \ No newline at end of file diff --git a/tests/fixtures/api/database/2/metadata.json b/tests/fixtures/api/database/2/metadata.json new file mode 100644 index 00000000..cda0b6a3 --- /dev/null +++ b/tests/fixtures/api/database/2/metadata.json @@ -0,0 +1,1860 @@ +{ + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "tables": [ + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "show_in_getting_started": false, + "name": "customers", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.194597Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 38, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "customer_id", + "database_position": 0, + "fingerprint": { + "global": { + "distinct-count": 100, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.5, + "q3": 75.5, + "max": 100.0, + "sd": 29.008358252146028, + "avg": 50.5 + } + } + }, + "created_at": "2021-07-21T05:47:53.408064Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 7, + "coercion_strategy": null, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.242305Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 37, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.404944Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 7, + "coercion_strategy": null, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.249828Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 43, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.419931Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "name": "first_order", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.232032Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 39, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "first_order", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "created_at": "2021-07-21T05:47:53.410556Z", + "base_type": "type/Date", + "points_of_interest": null + }, + { + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "name": "most_recent_order", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.186143Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 42, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 4, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "most_recent_order", + "database_position": 4, + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.417127Z", + "base_type": "type/Date", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": "type/Quantity", + "table_id": 7, + "coercion_strategy": null, + "name": "number_of_orders", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.197576Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 40, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 5, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "number_of_orders", + "database_position": 5, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.0901356485315583, + "max": 5.0, + "sd": 0.7779687173818424, + "avg": 1.596774193548387 + } + } + }, + "created_at": "2021-07-21T05:47:53.412376Z", + "base_type": "type/BigInteger", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "name": "customer_lifetime_value", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.288463Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 41, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 6, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "customer_lifetime_value", + "database_position": 6, + "fingerprint": { + "global": { + "distinct-count": 36, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.464101615137753, + "q3": 35.46410161513776, + "max": 99.0, + "sd": 18.812245525263663, + "avg": 26.967741935483872 + } + } + }, + "created_at": "2021-07-21T05:47:53.414671Z", + "base_type": "type/BigInteger", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "metrics": [], + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "show_in_getting_started": false, + "name": "orders", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.255223Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 47, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_id", + "database_position": 0, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.25, + "q3": 74.75, + "max": 99.0, + "sd": 28.719704534890823, + "avg": 50.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.444318Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.259928Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 51, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "customer_id", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.452739Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.188819Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 46, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.441254Z", + "base_type": "type/Date", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.203655Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 50, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "status", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.450839Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "name": "credit_card_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.24496Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 44, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 4, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "credit_card_amount", + "database_position": 4, + "fingerprint": { + "global": { + "distinct-count": 25, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 18.797054997187544, + "max": 30.0, + "sd": 10.959088854927673, + "avg": 8.797979797979798 + } + } + }, + "created_at": "2021-07-21T05:47:53.43752Z", + "base_type": "type/BigInteger", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "name": "coupon_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.25752Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 49, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 5, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "coupon_amount", + "database_position": 5, + "fingerprint": { + "global": { + "distinct-count": 12, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.4747603274810728, + "max": 26.0, + "sd": 5.955012405351229, + "avg": 1.8686868686868687 + } + } + }, + "created_at": "2021-07-21T05:47:53.448941Z", + "base_type": "type/BigInteger", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "name": "bank_transfer_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.25288Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 45, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 6, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "bank_transfer_amount", + "database_position": 6, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 4.75, + "max": 26.0, + "sd": 7.420825132023675, + "avg": 4.151515151515151 + } + } + }, + "created_at": "2021-07-21T05:47:53.43953Z", + "base_type": "type/BigInteger", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "name": "gift_card_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.201036Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 48, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 7, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "gift_card_amount", + "database_position": 7, + "fingerprint": { + "global": { + "distinct-count": 11, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 1.3692088763283736, + "max": 30.0, + "sd": 6.392362351566517, + "avg": 2.0707070707070705 + } + } + }, + "created_at": "2021-07-21T05:47:53.447026Z", + "base_type": "type/BigInteger", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int8", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.206083Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 52, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 8, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "amount", + "database_position": 8, + "fingerprint": { + "global": { + "distinct-count": 32, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 8.202945002812456, + "q3": 24.26138721247417, + "max": 58.0, + "sd": 10.736062525374601, + "avg": 16.88888888888889 + } + } + }, + "created_at": "2021-07-21T05:47:53.455652Z", + "base_type": "type/BigInteger", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "metrics": [], + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "show_in_getting_started": false, + "name": "raw_customers", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 9, + "coercion_strategy": null, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.234376Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 55, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "id", + "database_position": 0, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.473642Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 9, + "coercion_strategy": null, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.208554Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 53, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.469932Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 9, + "coercion_strategy": null, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.262668Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 54, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.471892Z", + "base_type": "type/Text", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.166218Z", + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "metrics": [], + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "show_in_getting_started": false, + "name": "raw_orders", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 12, + "coercion_strategy": null, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.266036Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 57, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "id", + "database_position": 0, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.48931Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 12, + "coercion_strategy": null, + "name": "user_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.214697Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 59, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "user_id", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.494231Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 12, + "coercion_strategy": null, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.268564Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 56, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.48571Z", + "base_type": "type/Date", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 12, + "coercion_strategy": null, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.211374Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 58, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "status", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.491699Z", + "base_type": "type/Text", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "metrics": [], + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "show_in_getting_started": false, + "name": "raw_payments", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 11, + "coercion_strategy": null, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.271155Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 62, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "id", + "database_position": 0, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.511724Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 11, + "coercion_strategy": null, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.247411Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 60, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_id", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 24.904857366030992, + "q3": 75.25, + "max": 99.0, + "sd": 28.540193317267853, + "avg": 50.0353982300885 + } + } + }, + "created_at": "2021-07-21T05:47:53.506967Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 11, + "coercion_strategy": null, + "name": "payment_method", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.217422Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 61, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "payment_method", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 10.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.508887Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": "type/Category", + "table_id": 11, + "coercion_strategy": null, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.273607Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 63, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "amount", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 30, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 606.4037815689348, + "q3": 2278.791845139511, + "max": 3000.0, + "sd": 919.836873351873, + "avg": 1479.646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.513727Z", + "base_type": "type/Integer", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "metrics": [], + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "show_in_getting_started": false, + "name": "stg_customers", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 8, + "coercion_strategy": null, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.276108Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 65, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "customer_id", + "database_position": 0, + "fingerprint": { + "global": { + "distinct-count": 100, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.5, + "q3": 75.5, + "max": 100.0, + "sd": 29.008358252146028, + "avg": 50.5 + } + } + }, + "created_at": "2021-07-21T05:47:53.528091Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 8, + "coercion_strategy": null, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.220226Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 64, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.525589Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 8, + "coercion_strategy": null, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.222931Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 66, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.530075Z", + "base_type": "type/Text", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.176617Z", + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "metrics": [], + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "show_in_getting_started": false, + "name": "stg_orders", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.225874Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 68, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_id", + "database_position": 0, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.25, + "q3": 74.75, + "max": 99.0, + "sd": 28.719704534890823, + "avg": 50.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.545842Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.229545Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 70, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "customer_id", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.549796Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.285732Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 67, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.543598Z", + "base_type": "type/Date", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 5, + "coercion_strategy": null, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.27984Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 69, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "status", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.547849Z", + "base_type": "type/Text", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "metrics": [], + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "show_in_getting_started": false, + "name": "stg_payments", + "fields": [ + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 10, + "coercion_strategy": null, + "name": "payment_id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.191434Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 74, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "payment_id", + "database_position": 0, + "fingerprint": { + "global": { + "distinct-count": 113, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 28.75, + "q3": 85.25, + "max": 113.0, + "sd": 32.76097144469315, + "avg": 57.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.570339Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 10, + "coercion_strategy": null, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.282867Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 71, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "order_id", + "database_position": 1, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 24.904857366030992, + "q3": 75.25, + "max": 99.0, + "sd": 28.540193317267853, + "avg": 50.0353982300885 + } + } + }, + "created_at": "2021-07-21T05:47:53.562985Z", + "base_type": "type/Integer", + "points_of_interest": null + }, + { + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 10, + "coercion_strategy": null, + "name": "payment_method", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.236542Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 72, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "payment_method", + "database_position": 2, + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 10.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.566146Z", + "base_type": "type/Text", + "points_of_interest": null + }, + { + "description": null, + "database_type": "int4", + "semantic_type": "type/Category", + "table_id": 10, + "coercion_strategy": null, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "updated_at": "2021-07-21T07:30:35.240154Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 73, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "target": null, + "preview_display": true, + "display_name": "amount", + "database_position": 3, + "fingerprint": { + "global": { + "distinct-count": 30, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 6.064037815689349, + "q3": 22.787918451395115, + "max": 30.0, + "sd": 9.198368733518729, + "avg": 14.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.568245Z", + "base_type": "type/Integer", + "points_of_interest": null + } + ], + "caveats": null, + "segments": [], + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "metrics": [], + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + } + ], + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/37.json b/tests/fixtures/api/field/37.json new file mode 100644 index 00000000..2aa1dea9 --- /dev/null +++ b/tests/fixtures/api/field/37.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.242305Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 37, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.404944Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/38.json b/tests/fixtures/api/field/38.json new file mode 100644 index 00000000..ba3d530d --- /dev/null +++ b/tests/fixtures/api/field/38.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.194597Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 38, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "customer_id", + "database_position": 0, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 100, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.5, + "q3": 75.5, + "max": 100.0, + "sd": 29.008358252146028, + "avg": 50.5 + } + } + }, + "created_at": "2021-07-21T05:47:53.408064Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/39.json b/tests/fixtures/api/field/39.json new file mode 100644 index 00000000..2dfd6ea9 --- /dev/null +++ b/tests/fixtures/api/field/39.json @@ -0,0 +1,108 @@ +{ + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "first_order", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.232032Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 39, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "first_order", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 47, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-07" + } + } + }, + "created_at": "2021-07-21T05:47:53.410556Z", + "base_type": "type/Date", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/40.json b/tests/fixtures/api/field/40.json new file mode 100644 index 00000000..43142685 --- /dev/null +++ b/tests/fixtures/api/field/40.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": "type/Quantity", + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "number_of_orders", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.197576Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 40, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 5, + "visibility_type": "normal", + "preview_display": true, + "display_name": "number_of_orders", + "database_position": 5, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 1.0, + "q3": 2.0901356485315583, + "max": 5.0, + "sd": 0.7779687173818424, + "avg": 1.596774193548387 + } + } + }, + "created_at": "2021-07-21T05:47:53.412376Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/41.json b/tests/fixtures/api/field/41.json new file mode 100644 index 00000000..b602c7ad --- /dev/null +++ b/tests/fixtures/api/field/41.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "customer_lifetime_value", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.288463Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 41, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 6, + "visibility_type": "normal", + "preview_display": true, + "display_name": "customer_lifetime_value", + "database_position": 6, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 36, + "nil%": 0.38 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 13.464101615137753, + "q3": 35.46410161513776, + "max": 99.0, + "sd": 18.812245525263663, + "avg": 26.967741935483872 + } + } + }, + "created_at": "2021-07-21T05:47:53.414671Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/42.json b/tests/fixtures/api/field/42.json new file mode 100644 index 00000000..22b3a5a1 --- /dev/null +++ b/tests/fixtures/api/field/42.json @@ -0,0 +1,108 @@ +{ + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "most_recent_order", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.186143Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 42, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 4, + "visibility_type": "normal", + "preview_display": true, + "display_name": "most_recent_order", + "database_position": 4, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 53, + "nil%": 0.38 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-09", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.417127Z", + "base_type": "type/Date", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/43.json b/tests/fixtures/api/field/43.json new file mode 100644 index 00000000..2e643af8 --- /dev/null +++ b/tests/fixtures/api/field/43.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 7, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.249828Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 43, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.419931Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/44.json b/tests/fixtures/api/field/44.json new file mode 100644 index 00000000..130e5eda --- /dev/null +++ b/tests/fixtures/api/field/44.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "credit_card_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.24496Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 44, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 4, + "visibility_type": "normal", + "preview_display": true, + "display_name": "credit_card_amount", + "database_position": 4, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 25, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 18.797054997187544, + "max": 30.0, + "sd": 10.959088854927673, + "avg": 8.797979797979798 + } + } + }, + "created_at": "2021-07-21T05:47:53.43752Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/45.json b/tests/fixtures/api/field/45.json new file mode 100644 index 00000000..fcbf0092 --- /dev/null +++ b/tests/fixtures/api/field/45.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "bank_transfer_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.25288Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 45, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 6, + "visibility_type": "normal", + "preview_display": true, + "display_name": "bank_transfer_amount", + "database_position": 6, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 4.75, + "max": 26.0, + "sd": 7.420825132023675, + "avg": 4.151515151515151 + } + } + }, + "created_at": "2021-07-21T05:47:53.43953Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/46.json b/tests/fixtures/api/field/46.json new file mode 100644 index 00000000..4ff41998 --- /dev/null +++ b/tests/fixtures/api/field/46.json @@ -0,0 +1,108 @@ +{ + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.188819Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 46, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.441254Z", + "base_type": "type/Date", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/47.json b/tests/fixtures/api/field/47.json new file mode 100644 index 00000000..aa31ae05 --- /dev/null +++ b/tests/fixtures/api/field/47.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.255223Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 47, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_id", + "database_position": 0, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.25, + "q3": 74.75, + "max": 99.0, + "sd": 28.719704534890823, + "avg": 50.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.444318Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/48.json b/tests/fixtures/api/field/48.json new file mode 100644 index 00000000..e4de2b55 --- /dev/null +++ b/tests/fixtures/api/field/48.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "gift_card_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.201036Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 48, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 7, + "visibility_type": "normal", + "preview_display": true, + "display_name": "gift_card_amount", + "database_position": 7, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 11, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 1.3692088763283736, + "max": 30.0, + "sd": 6.392362351566517, + "avg": 2.0707070707070705 + } + } + }, + "created_at": "2021-07-21T05:47:53.447026Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/49.json b/tests/fixtures/api/field/49.json new file mode 100644 index 00000000..703394d6 --- /dev/null +++ b/tests/fixtures/api/field/49.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "coupon_amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.25752Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 49, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 5, + "visibility_type": "normal", + "preview_display": true, + "display_name": "coupon_amount", + "database_position": 5, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 12, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 0.0, + "q3": 0.4747603274810728, + "max": 26.0, + "sd": 5.955012405351229, + "avg": 1.8686868686868687 + } + } + }, + "created_at": "2021-07-21T05:47:53.448941Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/50.json b/tests/fixtures/api/field/50.json new file mode 100644 index 00000000..7c383f83 --- /dev/null +++ b/tests/fixtures/api/field/50.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.203655Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 50, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "status", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.450839Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/51.json b/tests/fixtures/api/field/51.json new file mode 100644 index 00000000..23682fa2 --- /dev/null +++ b/tests/fixtures/api/field/51.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.259928Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 51, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "customer_id", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.452739Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/52.json b/tests/fixtures/api/field/52.json new file mode 100644 index 00000000..be94486d --- /dev/null +++ b/tests/fixtures/api/field/52.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int8", + "semantic_type": null, + "table_id": 6, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.206083Z", + "custom_position": 0, + "effective_type": "type/BigInteger", + "active": true, + "parent_id": null, + "id": 52, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 8, + "visibility_type": "normal", + "preview_display": true, + "display_name": "amount", + "database_position": 8, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 32, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 8.202945002812456, + "q3": 24.26138721247417, + "max": 58.0, + "sd": 10.736062525374601, + "avg": 16.88888888888889 + } + } + }, + "created_at": "2021-07-21T05:47:53.455652Z", + "base_type": "type/BigInteger", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/53.json b/tests/fixtures/api/field/53.json new file mode 100644 index 00000000..0f077f91 --- /dev/null +++ b/tests/fixtures/api/field/53.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 9, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.166218Z", + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null + }, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.208554Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 53, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.469932Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/54.json b/tests/fixtures/api/field/54.json new file mode 100644 index 00000000..5d3ae3b1 --- /dev/null +++ b/tests/fixtures/api/field/54.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 9, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.166218Z", + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null + }, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.262668Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 54, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.471892Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/55.json b/tests/fixtures/api/field/55.json new file mode 100644 index 00000000..a7703e04 --- /dev/null +++ b/tests/fixtures/api/field/55.json @@ -0,0 +1,104 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 9, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.166218Z", + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null + }, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.234376Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 55, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "id", + "database_position": 0, + "name_field": { + "id": 54, + "table_id": 9, + "display_name": "last_name", + "base_type": "type/Text", + "semantic_type": "type/Name", + "has_field_values": "list" + }, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.473642Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/56.json b/tests/fixtures/api/field/56.json new file mode 100644 index 00000000..fba8f2a8 --- /dev/null +++ b/tests/fixtures/api/field/56.json @@ -0,0 +1,108 @@ +{ + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 12, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.268564Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 56, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.48571Z", + "base_type": "type/Date", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/57.json b/tests/fixtures/api/field/57.json new file mode 100644 index 00000000..81c19cc5 --- /dev/null +++ b/tests/fixtures/api/field/57.json @@ -0,0 +1,97 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 12, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.266036Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 57, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "id", + "database_position": 0, + "name_field": null, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.48931Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/58.json b/tests/fixtures/api/field/58.json new file mode 100644 index 00000000..647c3a66 --- /dev/null +++ b/tests/fixtures/api/field/58.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 12, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.211374Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 58, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "status", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.491699Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/59.json b/tests/fixtures/api/field/59.json new file mode 100644 index 00000000..207ef6ea --- /dev/null +++ b/tests/fixtures/api/field/59.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 12, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + "name": "user_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.214697Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 59, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "user_id", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.494231Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/60.json b/tests/fixtures/api/field/60.json new file mode 100644 index 00000000..99c5b1f1 --- /dev/null +++ b/tests/fixtures/api/field/60.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 11, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.247411Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 60, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_id", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 24.904857366030992, + "q3": 75.25, + "max": 99.0, + "sd": 28.540193317267853, + "avg": 50.0353982300885 + } + } + }, + "created_at": "2021-07-21T05:47:53.506967Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/61.json b/tests/fixtures/api/field/61.json new file mode 100644 index 00000000..7e1a37d8 --- /dev/null +++ b/tests/fixtures/api/field/61.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 11, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + "name": "payment_method", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.217422Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 61, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "payment_method", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 10.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.508887Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/62.json b/tests/fixtures/api/field/62.json new file mode 100644 index 00000000..0cd0029b --- /dev/null +++ b/tests/fixtures/api/field/62.json @@ -0,0 +1,97 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": "type/PK", + "table_id": 11, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + "name": "id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.271155Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 62, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "id", + "database_position": 0, + "name_field": null, + "fingerprint": null, + "created_at": "2021-07-21T05:47:53.511724Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/63.json b/tests/fixtures/api/field/63.json new file mode 100644 index 00000000..be19ef3c --- /dev/null +++ b/tests/fixtures/api/field/63.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": "type/Category", + "table_id": 11, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.273607Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 63, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "amount", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 30, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 606.4037815689348, + "q3": 2278.791845139511, + "max": 3000.0, + "sd": 919.836873351873, + "avg": 1479.646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.513727Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/64.json b/tests/fixtures/api/field/64.json new file mode 100644 index 00000000..0d1397a2 --- /dev/null +++ b/tests/fixtures/api/field/64.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 8, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.176617Z", + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null + }, + "name": "first_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.220226Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 64, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "first_name", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 79, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.02, + "average-length": 5.86 + } + } + }, + "created_at": "2021-07-21T05:47:53.525589Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/65.json b/tests/fixtures/api/field/65.json new file mode 100644 index 00000000..4111128c --- /dev/null +++ b/tests/fixtures/api/field/65.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 8, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.176617Z", + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null + }, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.276108Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 65, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "customer_id", + "database_position": 0, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 100, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.5, + "q3": 75.5, + "max": 100.0, + "sd": 29.008358252146028, + "avg": 50.5 + } + } + }, + "created_at": "2021-07-21T05:47:53.528091Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/66.json b/tests/fixtures/api/field/66.json new file mode 100644 index 00000000..bcea2872 --- /dev/null +++ b/tests/fixtures/api/field/66.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Name", + "table_id": 8, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.176617Z", + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null + }, + "name": "last_name", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.222931Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 66, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "last_name", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 19, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 2.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.530075Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/67.json b/tests/fixtures/api/field/67.json new file mode 100644 index 00000000..3ba40c55 --- /dev/null +++ b/tests/fixtures/api/field/67.json @@ -0,0 +1,108 @@ +{ + "description": null, + "database_type": "date", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + "name": "order_date", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.285732Z", + "custom_position": 0, + "effective_type": "type/Date", + "active": true, + "parent_id": null, + "id": 67, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_date", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 69, + "nil%": 0.0 + }, + "type": { + "type/DateTime": { + "earliest": "2018-01-01", + "latest": "2018-04-09" + } + } + }, + "created_at": "2021-07-21T05:47:53.543598Z", + "base_type": "type/Date", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/68.json b/tests/fixtures/api/field/68.json new file mode 100644 index 00000000..b936f0ba --- /dev/null +++ b/tests/fixtures/api/field/68.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.225874Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 68, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_id", + "database_position": 0, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.25, + "q3": 74.75, + "max": 99.0, + "sd": 28.719704534890823, + "avg": 50.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.545842Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/69.json b/tests/fixtures/api/field/69.json new file mode 100644 index 00000000..0aad7741 --- /dev/null +++ b/tests/fixtures/api/field/69.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 5, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + "name": "status", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.27984Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 69, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "status", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 5, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 8.404040404040405 + } + } + }, + "created_at": "2021-07-21T05:47:53.547849Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/70.json b/tests/fixtures/api/field/70.json new file mode 100644 index 00000000..cfd9c44c --- /dev/null +++ b/tests/fixtures/api/field/70.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 5, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + "name": "customer_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.229545Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 70, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "customer_id", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 62, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 25.875, + "q3": 69.625, + "max": 99.0, + "sd": 27.781341350472964, + "avg": 48.25252525252525 + } + } + }, + "created_at": "2021-07-21T05:47:53.549796Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/71.json b/tests/fixtures/api/field/71.json new file mode 100644 index 00000000..8b4b42be --- /dev/null +++ b/tests/fixtures/api/field/71.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 10, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + }, + "name": "order_id", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.282867Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 71, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 1, + "visibility_type": "normal", + "preview_display": true, + "display_name": "order_id", + "database_position": 1, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 99, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 24.904857366030992, + "q3": 75.25, + "max": 99.0, + "sd": 28.540193317267853, + "avg": 50.0353982300885 + } + } + }, + "created_at": "2021-07-21T05:47:53.562985Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/72.json b/tests/fixtures/api/field/72.json new file mode 100644 index 00000000..3a051059 --- /dev/null +++ b/tests/fixtures/api/field/72.json @@ -0,0 +1,111 @@ +{ + "description": null, + "database_type": "text", + "semantic_type": "type/Category", + "table_id": 10, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + }, + "name": "payment_method", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.236542Z", + "custom_position": 0, + "effective_type": "type/Text", + "active": true, + "parent_id": null, + "id": 72, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 2, + "visibility_type": "normal", + "preview_display": true, + "display_name": "payment_method", + "database_position": 2, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 4, + "nil%": 0.0 + }, + "type": { + "type/Text": { + "percent-json": 0.0, + "percent-url": 0.0, + "percent-email": 0.0, + "percent-state": 0.0, + "average-length": 10.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.566146Z", + "base_type": "type/Text", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/73.json b/tests/fixtures/api/field/73.json new file mode 100644 index 00000000..9dbb28b9 --- /dev/null +++ b/tests/fixtures/api/field/73.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": "type/Category", + "table_id": 10, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + }, + "name": "amount", + "fingerprint_version": 5, + "has_field_values": "list", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.240154Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 73, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 3, + "visibility_type": "normal", + "preview_display": true, + "display_name": "amount", + "database_position": 3, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 30, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 0.0, + "q1": 6.064037815689349, + "q3": 22.787918451395115, + "max": 30.0, + "sd": 9.198368733518729, + "avg": 14.79646017699115 + } + } + }, + "created_at": "2021-07-21T05:47:53.568245Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/field/74.json b/tests/fixtures/api/field/74.json new file mode 100644 index 00000000..9d212e89 --- /dev/null +++ b/tests/fixtures/api/field/74.json @@ -0,0 +1,112 @@ +{ + "description": null, + "database_type": "int4", + "semantic_type": null, + "table_id": 10, + "coercion_strategy": null, + "table": { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + }, + "name": "payment_id", + "fingerprint_version": 5, + "has_field_values": "none", + "settings": null, + "caveats": null, + "fk_target_field_id": null, + "dimensions": [], + "updated_at": "2021-07-21T07:30:35.191434Z", + "custom_position": 0, + "effective_type": "type/Integer", + "active": true, + "parent_id": null, + "id": 74, + "last_analyzed": "2021-07-21T05:47:54.560768Z", + "position": 0, + "visibility_type": "normal", + "preview_display": true, + "display_name": "payment_id", + "database_position": 0, + "name_field": null, + "fingerprint": { + "global": { + "distinct-count": 113, + "nil%": 0.0 + }, + "type": { + "type/Number": { + "min": 1.0, + "q1": 28.75, + "q3": 85.25, + "max": 113.0, + "sd": 32.76097144469315, + "avg": 57.0 + } + } + }, + "created_at": "2021-07-21T05:47:53.570339Z", + "base_type": "type/Integer", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/metric.json b/tests/fixtures/api/metric.json similarity index 100% rename from tests/fixtures/mock_api/api/metric.json rename to tests/fixtures/api/metric.json diff --git a/tests/fixtures/api/table.json b/tests/fixtures/api/table.json new file mode 100644 index 00000000..bf5ccd0a --- /dev/null +++ b/tests/fixtures/api/table.json @@ -0,0 +1,530 @@ +[ + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.166218Z", + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.176617Z", + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null + }, + { + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null + } +] \ No newline at end of file diff --git a/tests/fixtures/api/table/10.json b/tests/fixtures/api/table/10.json new file mode 100644 index 00000000..e9b877d7 --- /dev/null +++ b/tests/fixtures/api/table/10.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.181929Z", + "pk_field": null, + "entity_name": null, + "active": true, + "id": 10, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_payments", + "created_at": "2021-07-21T05:47:53.384404Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/11.json b/tests/fixtures/api/table/11.json new file mode 100644 index 00000000..c05ca64d --- /dev/null +++ b/tests/fixtures/api/table/11.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_payments", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.173953Z", + "pk_field": 62, + "entity_name": null, + "active": true, + "id": 11, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_payments", + "created_at": "2021-07-21T05:47:53.388179Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/12.json b/tests/fixtures/api/table/12.json new file mode 100644 index 00000000..dcb53439 --- /dev/null +++ b/tests/fixtures/api/table/12.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.170459Z", + "pk_field": 57, + "entity_name": null, + "active": true, + "id": 12, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_orders", + "created_at": "2021-07-21T05:47:53.391873Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/5.json b/tests/fixtures/api/table/5.json new file mode 100644 index 00000000..f4b9d2a0 --- /dev/null +++ b/tests/fixtures/api/table/5.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.179323Z", + "pk_field": null, + "entity_name": null, + "active": true, + "id": 5, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_orders", + "created_at": "2021-07-21T05:47:53.363321Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/6.json b/tests/fixtures/api/table/6.json new file mode 100644 index 00000000..fb10e645 --- /dev/null +++ b/tests/fixtures/api/table/6.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/TransactionTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "orders", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.162732Z", + "pk_field": null, + "entity_name": null, + "active": true, + "id": 6, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "orders", + "created_at": "2021-07-21T05:47:53.368244Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/7.json b/tests/fixtures/api/table/7.json new file mode 100644 index 00000000..3c0e9455 --- /dev/null +++ b/tests/fixtures/api/table/7.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.159586Z", + "pk_field": null, + "entity_name": null, + "active": true, + "id": 7, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "customers", + "created_at": "2021-07-21T05:47:53.372467Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/8.json b/tests/fixtures/api/table/8.json new file mode 100644 index 00000000..41981606 --- /dev/null +++ b/tests/fixtures/api/table/8.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "stg_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.176617Z", + "pk_field": null, + "entity_name": null, + "active": true, + "id": 8, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "stg_customers", + "created_at": "2021-07-21T05:47:53.376525Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/table/9.json b/tests/fixtures/api/table/9.json new file mode 100644 index 00000000..77dddbc8 --- /dev/null +++ b/tests/fixtures/api/table/9.json @@ -0,0 +1,67 @@ +{ + "description": null, + "entity_type": "entity/GenericTable", + "schema": "public", + "db": { + "description": null, + "features": [ + "full-join", + "basic-aggregations", + "standard-deviation-aggregations", + "expression-aggregations", + "percentile-aggregations", + "foreign-keys", + "right-join", + "left-join", + "native-parameters", + "nested-queries", + "expressions", + "set-timezone", + "regex", + "case-sensitivity-string-filter-options", + "binning", + "inner-join", + "advanced-math-expressions" + ], + "cache_field_values_schedule": "0 0 22 * * ? *", + "timezone": "UTC", + "auto_run_queries": true, + "metadata_sync_schedule": "0 46 * * * ? *", + "name": "unit_testing", + "caveats": null, + "is_full_sync": true, + "updated_at": "2021-07-21T07:05:13.699978Z", + "details": { + "host": "postgres", + "port": null, + "dbname": "test", + "user": "postgres", + "password": "**MetabasePass**", + "ssl": false, + "additional-options": null, + "tunnel-enabled": false + }, + "is_sample": false, + "id": 2, + "is_on_demand": false, + "options": null, + "engine": "postgres", + "refingerprint": null, + "created_at": "2021-07-21T05:38:53.637091Z", + "points_of_interest": null + }, + "show_in_getting_started": false, + "name": "raw_customers", + "caveats": null, + "updated_at": "2021-07-21T07:30:35.166218Z", + "pk_field": 55, + "entity_name": null, + "active": true, + "id": 9, + "db_id": 2, + "visibility_type": null, + "field_order": "database", + "display_name": "raw_customers", + "created_at": "2021-07-21T05:47:53.380782Z", + "points_of_interest": null +} \ No newline at end of file diff --git a/tests/fixtures/api/user.json b/tests/fixtures/api/user.json new file mode 100644 index 00000000..5f6cb950 --- /dev/null +++ b/tests/fixtures/api/user.json @@ -0,0 +1,24 @@ +[ + { + "email": "user@example.com", + "ldap_auth": false, + "first_name": "dbtmetabase", + "locale": null, + "last_login": "2021-07-21T19:25:28.6083Z", + "is_active": true, + "is_qbnewb": false, + "updated_at": "2021-07-21T19:25:28.6083", + "group_ids": [ + 1, + 2 + ], + "is_superuser": true, + "login_attributes": null, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "personal_collection_id": 1, + "common_name": "dbtmetabase", + "google_auth": false + } +] \ No newline at end of file diff --git a/tests/fixtures/api/user/1.json b/tests/fixtures/api/user/1.json new file mode 100644 index 00000000..907c5be0 --- /dev/null +++ b/tests/fixtures/api/user/1.json @@ -0,0 +1,21 @@ +{ + "email": "user@example.com", + "ldap_auth": false, + "first_name": "dbtmetabase", + "locale": null, + "last_login": "2021-07-21T19:25:28.6083Z", + "is_active": true, + "is_qbnewb": false, + "updated_at": "2021-07-21T19:25:28.6083", + "group_ids": [ + 1, + 2 + ], + "is_superuser": true, + "login_attributes": null, + "id": 1, + "last_name": "", + "date_joined": "2021-07-21T05:38:53.637091Z", + "common_name": "dbtmetabase", + "google_auth": false +} \ No newline at end of file diff --git a/tests/fixtures/dbt/manifest.json b/tests/fixtures/dbt/manifest.json deleted file mode 100644 index a4cbdd21..00000000 --- a/tests/fixtures/dbt/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v2.json", "dbt_version": "0.20.0", "generated_at": "2021-07-21T07:41:33.196162Z", "invocation_id": "425a0ecf-fdf8-4f90-a96d-e094466d3853", "env": {}, "project_id": "06e5b98c2db46f8a72cc4f66410e9b3b", "user_id": "aa538d43-e1f3-44a7-8a02-ab1328c70052", "send_anonymous_usage_stats": true, "adapter_type": "postgres"}, "nodes": {"model.jaffle_shop.orders": {"raw_sql": "{% set payment_methods = ['credit_card', 'coupon', 'bank_transfer', 'gift_card'] %}\n\nwith orders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\npayments as (\n\n select * from {{ ref('stg_payments') }}\n\n),\n\norder_payments as (\n\n select\n order_id,\n\n {% for payment_method in payment_methods -%}\n sum(case when payment_method = '{{ payment_method }}' then amount else 0 end) as {{ payment_method }}_amount,\n {% endfor -%}\n\n sum(amount) as total_amount\n\n from payments\n\n group by 1\n\n),\n\nfinal as (\n\n select\n orders.order_id,\n orders.customer_id,\n orders.order_date,\n orders.status,\n\n {% for payment_method in payment_methods -%}\n\n order_payments.{{ payment_method }}_amount,\n\n {% endfor -%}\n\n order_payments.total_amount as amount\n\n from orders\n\n left join order_payments using (order_id)\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_indexes", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"], "nodes": ["model.jaffle_shop.stg_orders", "model.jaffle_shop.stg_payments"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "orders"], "unique_id": "model.jaffle_shop.orders", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "orders.sql", "original_file_path": "models/orders.sql", "name": "orders", "alias": "orders", "checksum": {"name": "sha256", "checksum": "ec3e8884f18110dd6d9b1ababdd85a6c04bf665ee0f57cade273e442f90e9994"}, "tags": [], "refs": [["stg_orders"], ["stg_payments"]], "sources": [], "description": "This table has basic information about orders, as well as some derived facts based on payments", "columns": {"order_id": {"name": "order_id", "description": "This is a unique identifier for an order", "meta": {}, "data_type": null, "quote": null, "tags": []}, "customer_id": {"name": "customer_id", "description": "Foreign key to the customers table", "meta": {}, "data_type": null, "quote": null, "tags": []}, "order_date": {"name": "order_date", "description": "Date (UTC) that the order was placed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", "meta": {}, "data_type": null, "quote": null, "tags": []}, "amount": {"name": "amount", "description": "Total amount (AUD) of the order", "meta": {}, "data_type": null, "quote": null, "tags": []}, "credit_card_amount": {"name": "credit_card_amount", "description": "Amount of the order (AUD) paid for by credit card", "meta": {}, "data_type": null, "quote": null, "tags": []}, "coupon_amount": {"name": "coupon_amount", "description": "Amount of the order (AUD) paid for by coupon", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bank_transfer_amount": {"name": "bank_transfer_amount", "description": "Amount of the order (AUD) paid for by bank transfer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gift_card_amount": {"name": "gift_card_amount", "description": "Amount of the order (AUD) paid for by gift card", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "jaffle_shop://models/schema.yml", "compiled_path": "target/compiled/jaffle_shop/models/orders.sql", "build_path": "target/run/jaffle_shop/models/orders.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1626853293, "compiled_sql": "\n\nwith orders as (\n\n select * from \"test\".\"public\".\"stg_orders\"\n\n),\n\npayments as (\n\n select * from \"test\".\"public\".\"stg_payments\"\n\n),\n\norder_payments as (\n\n select\n order_id,\n\n sum(case when payment_method = 'credit_card' then amount else 0 end) as credit_card_amount,\n sum(case when payment_method = 'coupon' then amount else 0 end) as coupon_amount,\n sum(case when payment_method = 'bank_transfer' then amount else 0 end) as bank_transfer_amount,\n sum(case when payment_method = 'gift_card' then amount else 0 end) as gift_card_amount,\n sum(amount) as total_amount\n\n from payments\n\n group by 1\n\n),\n\nfinal as (\n\n select\n orders.order_id,\n orders.customer_id,\n orders.order_date,\n orders.status,\n\n order_payments.credit_card_amount,\n\n order_payments.coupon_amount,\n\n order_payments.bank_transfer_amount,\n\n order_payments.gift_card_amount,\n\n order_payments.total_amount as amount\n\n from orders\n\n left join order_payments using (order_id)\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"test\".\"public\".\"orders\""}, "model.jaffle_shop.customers": {"raw_sql": "with customers as (\n\n select * from {{ ref('stg_customers') }}\n\n),\n\norders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\npayments as (\n\n select * from {{ ref('stg_payments') }}\n\n),\n\ncustomer_orders as (\n\n select\n customer_id,\n\n min(order_date) as first_order,\n max(order_date) as most_recent_order,\n count(order_id) as number_of_orders\n from orders\n\n group by 1\n\n),\n\ncustomer_payments as (\n\n select\n orders.customer_id,\n sum(amount) as total_amount\n\n from payments\n\n left join orders using (order_id)\n\n group by 1\n\n),\n\nfinal as (\n\n select\n customers.customer_id,\n customers.first_name,\n customers.last_name,\n customer_orders.first_order,\n customer_orders.most_recent_order,\n customer_orders.number_of_orders,\n customer_payments.total_amount as customer_lifetime_value\n\n from customers\n\n left join customer_orders using (customer_id)\n\n left join customer_payments using (customer_id)\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_indexes", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"], "nodes": ["model.jaffle_shop.stg_customers", "model.jaffle_shop.stg_orders", "model.jaffle_shop.stg_payments"]}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "customers"], "unique_id": "model.jaffle_shop.customers", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "customers.sql", "original_file_path": "models/customers.sql", "name": "customers", "alias": "customers", "checksum": {"name": "sha256", "checksum": "7f193a2c3af2faa53e0bb7b75d2663f39db8c6b3913e9cafd245dc62f98a8d09"}, "tags": [], "refs": [["stg_customers"], ["stg_orders"], ["stg_payments"]], "sources": [], "description": "This table has basic information about a customer, as well as some derived facts based on a customer's orders", "columns": {"customer_id": {"name": "customer_id", "description": "This is a unique identifier for a customer", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_name": {"name": "first_name", "description": "Customer's first name. PII.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_name": {"name": "last_name", "description": "Customer's last name. PII.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_order": {"name": "first_order", "description": "Date (UTC) of a customer's first order", "meta": {}, "data_type": null, "quote": null, "tags": []}, "most_recent_order": {"name": "most_recent_order", "description": "Date (UTC) of a customer's most recent order", "meta": {}, "data_type": null, "quote": null, "tags": []}, "number_of_orders": {"name": "number_of_orders", "description": "Count of the number of orders a customer has placed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_order_amount": {"name": "total_order_amount", "description": "Total value (AUD) of a customer's orders", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "jaffle_shop://models/schema.yml", "compiled_path": "target/compiled/jaffle_shop/models/customers.sql", "build_path": "target/run/jaffle_shop/models/customers.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "created_at": 1626853293, "compiled_sql": "with customers as (\n\n select * from \"test\".\"public\".\"stg_customers\"\n\n),\n\norders as (\n\n select * from \"test\".\"public\".\"stg_orders\"\n\n),\n\npayments as (\n\n select * from \"test\".\"public\".\"stg_payments\"\n\n),\n\ncustomer_orders as (\n\n select\n customer_id,\n\n min(order_date) as first_order,\n max(order_date) as most_recent_order,\n count(order_id) as number_of_orders\n from orders\n\n group by 1\n\n),\n\ncustomer_payments as (\n\n select\n orders.customer_id,\n sum(amount) as total_amount\n\n from payments\n\n left join orders using (order_id)\n\n group by 1\n\n),\n\nfinal as (\n\n select\n customers.customer_id,\n customers.first_name,\n customers.last_name,\n customer_orders.first_order,\n customer_orders.most_recent_order,\n customer_orders.number_of_orders,\n customer_payments.total_amount as customer_lifetime_value\n\n from customers\n\n left join customer_orders using (customer_id)\n\n left join customer_payments using (customer_id)\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"test\".\"public\".\"customers\""}, "model.jaffle_shop.stg_orders": {"raw_sql": "with source as (\n\n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_orders') }}\n\n),\n\nrenamed as (\n\n select\n id as order_id,\n user_id as customer_id,\n order_date,\n status\n\n from source\n\n)\n\nselect * from renamed", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"], "nodes": ["seed.jaffle_shop.raw_orders"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "staging", "stg_orders"], "unique_id": "model.jaffle_shop.stg_orders", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "staging/stg_orders.sql", "original_file_path": "models/staging/stg_orders.sql", "name": "stg_orders", "alias": "stg_orders", "checksum": {"name": "sha256", "checksum": "afffa9cbc57e5fd2cf5898ebf571d444a62c9d6d7929d8133d30567fb9a2ce97"}, "tags": [], "refs": [["raw_orders"]], "sources": [], "description": "", "columns": {"order_id": {"name": "order_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "jaffle_shop://models/staging/schema.yml", "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_orders.sql", "build_path": "target/run/jaffle_shop/models/staging/stg_orders.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "created_at": 1626853293, "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_orders\"\n\n),\n\nrenamed as (\n\n select\n id as order_id,\n user_id as customer_id,\n order_date,\n status\n\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"test\".\"public\".\"stg_orders\""}, "model.jaffle_shop.stg_payments": {"raw_sql": "with source as (\n \n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_payments') }}\n\n),\n\nrenamed as (\n\n select\n id as payment_id,\n order_id,\n payment_method,\n\n --`amount` is currently stored in cents, so we convert it to dollars\n amount / 100 as amount\n\n from source\n\n)\n\nselect * from renamed", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"], "nodes": ["seed.jaffle_shop.raw_payments"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "staging", "stg_payments"], "unique_id": "model.jaffle_shop.stg_payments", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "staging/stg_payments.sql", "original_file_path": "models/staging/stg_payments.sql", "name": "stg_payments", "alias": "stg_payments", "checksum": {"name": "sha256", "checksum": "113502ed19f04efb2af0629ff139f57f7463347b6d5218f3b80a8d128cc96852"}, "tags": [], "refs": [["raw_payments"]], "sources": [], "description": "", "columns": {"payment_id": {"name": "payment_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}, "payment_method": {"name": "payment_method", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "jaffle_shop://models/staging/schema.yml", "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_payments.sql", "build_path": "target/run/jaffle_shop/models/staging/stg_payments.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "created_at": 1626853293, "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_payments\"\n\n),\n\nrenamed as (\n\n select\n id as payment_id,\n order_id,\n payment_method,\n\n --`amount` is currently stored in cents, so we convert it to dollars\n amount / 100 as amount\n\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"test\".\"public\".\"stg_payments\""}, "model.jaffle_shop.stg_customers": {"raw_sql": "with source as (\n\n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_customers') }}\n\n),\n\nrenamed as (\n\n select\n id as customer_id,\n first_name,\n last_name\n\n from source\n\n)\n\nselect * from renamed", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"], "nodes": ["seed.jaffle_shop.raw_customers"]}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "staging", "stg_customers"], "unique_id": "model.jaffle_shop.stg_customers", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "staging/stg_customers.sql", "original_file_path": "models/staging/stg_customers.sql", "name": "stg_customers", "alias": "stg_customers", "checksum": {"name": "sha256", "checksum": "6f18a29204dad1de6dbb0c288144c4990742e0a1e065c3b2a67b5f98334c22ba"}, "tags": [], "refs": [["raw_customers"]], "sources": [], "description": "", "columns": {"customer_id": {"name": "customer_id", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "jaffle_shop://models/staging/schema.yml", "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_customers.sql", "build_path": "target/run/jaffle_shop/models/staging/stg_customers.sql", "deferred": false, "unrendered_config": {"materialized": "view"}, "created_at": 1626853293, "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_customers\"\n\n),\n\nrenamed as (\n\n select\n id as customer_id,\n first_name,\n last_name\n\n from source\n\n)\n\nselect * from renamed", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"test\".\"public\".\"stg_customers\""}, "seed.jaffle_shop.raw_customers": {"raw_sql": "", "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "raw_customers"], "unique_id": "seed.jaffle_shop.raw_customers", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "raw_customers.csv", "original_file_path": "seeds/raw_customers.csv", "name": "raw_customers", "alias": "raw_customers", "checksum": {"name": "sha256", "checksum": "24579b4b26098d43265376f3c50be8b10faf8e8fd95f5508074f10f76a12671d"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293}, "seed.jaffle_shop.raw_payments": {"raw_sql": "", "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "raw_payments"], "unique_id": "seed.jaffle_shop.raw_payments", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "raw_payments.csv", "original_file_path": "seeds/raw_payments.csv", "name": "raw_payments", "alias": "raw_payments", "checksum": {"name": "sha256", "checksum": "03fd407f3135f84456431a923f22fc185a2154079e210c20b690e3ab11687d11"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293}, "seed.jaffle_shop.raw_orders": {"raw_sql": "", "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": null, "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public", "fqn": ["jaffle_shop", "raw_orders"], "unique_id": "seed.jaffle_shop.raw_orders", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "raw_orders.csv", "original_file_path": "seeds/raw_orders.csv", "name": "raw_orders", "alias": "raw_orders", "checksum": {"name": "sha256", "checksum": "c5f309d84ba32f2a39235c59f2d4f6c855aedba7e215847c957f1a5f2fa80d3e"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293}, "test.jaffle_shop.unique_customers_customer_id.d48e126d80": {"raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('customers') }} where {{config.get('where')}}) customers{% else %}{{ ref('customers') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.jaffle_shop.customers"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "unique_customers_customer_id"], "unique_id": "test.jaffle_shop.unique_customers_customer_id.d48e126d80", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/unique_customers_customer_id.sql", "original_file_path": "models/schema.yml", "name": "unique_customers_customer_id", "alias": "unique_customers_customer_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["customers"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('customers') }} where {{config.get('where')}}) customers{% else %}{{ ref('customers') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.customers"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_customers_customer_id"], "unique_id": "test.jaffle_shop.not_null_customers_customer_id.923d2d910a", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_customers_customer_id.sql", "original_file_path": "models/schema.yml", "name": "not_null_customers_customer_id", "alias": "not_null_customers_customer_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["customers"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": {"raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "order_id", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "unique_orders_order_id"], "unique_id": "test.jaffle_shop.unique_orders_order_id.0d77ddcf59", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/unique_orders_order_id.sql", "original_file_path": "models/schema.yml", "name": "unique_orders_order_id", "alias": "unique_orders_order_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "order_id"}, "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "order_id", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_order_id"], "unique_id": "test.jaffle_shop.not_null_orders_order_id.4daff5eed7", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_order_id.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_order_id", "alias": "not_null_orders_order_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "order_id"}, "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_customer_id"], "unique_id": "test.jaffle_shop.not_null_orders_customer_id.70722cc05f", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_customer_id.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_customer_id", "alias": "not_null_orders_customer_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": {"raw_sql": "{{ test_relationships(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "relationships", "kwargs": {"to": "ref('customers')", "field": "customer_id", "column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_relationships", "macro.dbt.default__test_relationships"], "nodes": ["model.jaffle_shop.customers", "model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "relationships_orders_customer_id__customer_id__ref_customers_"], "unique_id": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/relationships_orders_customer_id__customer_id__ref_customers_.sql", "original_file_path": "models/schema.yml", "name": "relationships_orders_customer_id__customer_id__ref_customers_", "alias": "relationships_orders_customer_id__customer_id__ref_customers_", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["customers"], ["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": {"raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758\") }}", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["placed", "shipped", "completed", "return_pending", "returned"], "column_name": "status", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.default__test_accepted_values"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758", "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "accepted_values_orders_status__placed__shipped__completed__return_pending__returned"], "unique_id": "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758.sql", "original_file_path": "models/schema.yml", "name": "accepted_values_orders_status__placed__shipped__completed__return_pending__returned", "alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758"}, "created_at": 1626853293, "column_name": "status"}, "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "amount", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_amount"], "unique_id": "test.jaffle_shop.not_null_orders_amount.f7bae8de1b", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_amount.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_amount", "alias": "not_null_orders_amount", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "amount"}, "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "credit_card_amount", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_credit_card_amount"], "unique_id": "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_credit_card_amount.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_credit_card_amount", "alias": "not_null_orders_credit_card_amount", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "credit_card_amount"}, "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "coupon_amount", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_coupon_amount"], "unique_id": "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_coupon_amount.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_coupon_amount", "alias": "not_null_orders_coupon_amount", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "coupon_amount"}, "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "bank_transfer_amount", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_bank_transfer_amount"], "unique_id": "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_bank_transfer_amount.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_bank_transfer_amount", "alias": "not_null_orders_bank_transfer_amount", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "bank_transfer_amount"}, "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "gift_card_amount", "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_orders_gift_card_amount"], "unique_id": "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_orders_gift_card_amount.sql", "original_file_path": "models/schema.yml", "name": "not_null_orders_gift_card_amount", "alias": "not_null_orders_gift_card_amount", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "gift_card_amount"}, "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": {"raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_customers') }} where {{config.get('where')}}) stg_customers{% else %}{{ ref('stg_customers') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.jaffle_shop.stg_customers"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "unique_stg_customers_customer_id"], "unique_id": "test.jaffle_shop.unique_stg_customers_customer_id.5530022331", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/unique_stg_customers_customer_id.sql", "original_file_path": "models/staging/schema.yml", "name": "unique_stg_customers_customer_id", "alias": "unique_stg_customers_customer_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_customers"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "customer_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_customers') }} where {{config.get('where')}}) stg_customers{% else %}{{ ref('stg_customers') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.stg_customers"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_stg_customers_customer_id"], "unique_id": "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_stg_customers_customer_id.sql", "original_file_path": "models/staging/schema.yml", "name": "not_null_stg_customers_customer_id", "alias": "not_null_stg_customers_customer_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_customers"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "customer_id"}, "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": {"raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "order_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.jaffle_shop.stg_orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "unique_stg_orders_order_id"], "unique_id": "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/unique_stg_orders_order_id.sql", "original_file_path": "models/staging/schema.yml", "name": "unique_stg_orders_order_id", "alias": "unique_stg_orders_order_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "order_id"}, "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "order_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.stg_orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_stg_orders_order_id"], "unique_id": "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_stg_orders_order_id.sql", "original_file_path": "models/staging/schema.yml", "name": "not_null_stg_orders_order_id", "alias": "not_null_stg_orders_order_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "order_id"}, "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": {"raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58\") }}", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["placed", "shipped", "completed", "return_pending", "returned"], "column_name": "status", "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.default__test_accepted_values"], "nodes": ["model.jaffle_shop.stg_orders"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58", "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned"], "unique_id": "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58.sql", "original_file_path": "models/staging/schema.yml", "name": "accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned", "alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_orders"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58"}, "created_at": 1626853293, "column_name": "status"}, "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": {"raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "payment_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.jaffle_shop.stg_payments"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "unique_stg_payments_payment_id"], "unique_id": "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/unique_stg_payments_payment_id.sql", "original_file_path": "models/staging/schema.yml", "name": "unique_stg_payments_payment_id", "alias": "unique_stg_payments_payment_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_payments"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "payment_id"}, "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": {"raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "payment_id", "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.jaffle_shop.stg_payments"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "not_null_stg_payments_payment_id"], "unique_id": "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/not_null_stg_payments_payment_id.sql", "original_file_path": "models/staging/schema.yml", "name": "not_null_stg_payments_payment_id", "alias": "not_null_stg_payments_payment_id", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_payments"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1626853293, "column_name": "payment_id"}, "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": {"raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef\") }}", "test_metadata": {"name": "accepted_values", "kwargs": {"values": ["credit_card", "coupon", "bank_transfer", "gift_card"], "column_name": "payment_method", "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_accepted_values", "macro.dbt.default__test_accepted_values"], "nodes": ["model.jaffle_shop.stg_payments"]}, "config": {"enabled": true, "materialized": "test", "persist_docs": {}, "vars": {}, "quoting": {}, "column_types": {}, "alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef", "schema": "dbt_test__audit", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0", "post-hook": [], "pre-hook": []}, "database": "test", "schema": "public_dbt_test__audit", "fqn": ["jaffle_shop", "schema_test", "accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card"], "unique_id": "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "schema_test/accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef.sql", "original_file_path": "models/staging/schema.yml", "name": "accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card", "alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef", "checksum": {"name": "none", "checksum": ""}, "tags": ["schema"], "refs": [["stg_payments"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef"}, "created_at": 1626853293, "column_name": "payment_method"}}, "sources": {}, "macros": {"macro.dbt_postgres.postgres__create_table_as": {"unique_id": "macro.dbt_postgres.postgres__create_table_as", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_table_as", "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__get_create_index_sql": {"unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_create_index_sql", "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__create_schema": {"unique_id": "macro.dbt_postgres.postgres__create_schema", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_schema", "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__drop_schema": {"unique_id": "macro.dbt_postgres.postgres__drop_schema", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__drop_schema", "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__get_columns_in_relation": {"unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_columns_in_relation", "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.sql_convert_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__list_relations_without_caching": {"unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_relations_without_caching", "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__information_schema_name": {"unique_id": "macro.dbt_postgres.postgres__information_schema_name", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__information_schema_name", "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__list_schemas": {"unique_id": "macro.dbt_postgres.postgres__list_schemas", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_schemas", "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__check_schema_exists": {"unique_id": "macro.dbt_postgres.postgres__check_schema_exists", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__check_schema_exists", "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__current_timestamp": {"unique_id": "macro.dbt_postgres.postgres__current_timestamp", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__current_timestamp", "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__snapshot_string_as_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_string_as_time", "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__snapshot_get_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_get_time", "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__make_temp_relation": {"unique_id": "macro.dbt_postgres.postgres__make_temp_relation", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__make_temp_relation", "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix_length = suffix|length + dtstring|length %}\n {% set relation_max_name_length = 63 %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Temp relation suffix is too long (' ~ suffix|length ~ ' characters). Maximum length is ' ~ (relation_max_name_length - dtstring|length) ~ ' characters.') %}\n {% endif %}\n {% set tmp_identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix ~ dtstring %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres_escape_comment": {"unique_id": "macro.dbt_postgres.postgres_escape_comment", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres_escape_comment", "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__alter_relation_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_relation_comment", "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__alter_column_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_column_comment", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_column_comment", "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% for column_name in column_dict %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__get_catalog": {"unique_id": "macro.dbt_postgres.postgres__get_catalog", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "postgres__get_catalog", "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n\n {%- call statement('catalog', fetch_result=True) -%}\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n\n where (\n {%- for schema in schemas -%}\n upper(sch.nspname) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence = 'p' -- [p]ermanent table. Other values are [u]nlogged table, [t]emporary table\n and tbl.relkind in ('r', 'v', 'f', 'p') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table, [m]aterialized view\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres_get_relations": {"unique_id": "macro.dbt_postgres.postgres_get_relations", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "name": "postgres_get_relations", "macro_sql": "{% macro postgres_get_relations () -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt_postgres.postgres__snapshot_merge_sql": {"unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", "package_name": "dbt_postgres", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", "path": "macros/materializations/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot_merge.sql", "name": "postgres__snapshot_merge_sql", "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/is_incremental.sql", "original_file_path": "macros/etc/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/query.sql", "original_file_path": "macros/etc/query.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_alias.sql", "original_file_path": "macros/etc/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.column_list": {"unique_id": "macro.dbt.column_list", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list", "macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.column_list_for_create_table": {"unique_id": "macro.dbt.column_list_for_create_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list_for_create_table", "macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/test.sql", "original_file_path": "macros/materializations/test.sql", "name": "materialization_test_default", "macro_sql": "\n\n{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.basic_load_csv_rows": {"unique_id": "macro.dbt.basic_load_csv_rows", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "basic_load_csv_rows", "macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.basic_load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n ;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/fishtown-analytics/dbt/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% do adapter.drop_relation(intermediate_relation) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.should_full_refresh", "macro.dbt.make_temp_relation", "macro.dbt.run_query", "macro.dbt.incremental_upsert", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.incremental_upsert": {"unique_id": "macro.dbt.incremental_upsert", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/helpers.sql", "original_file_path": "macros/materializations/incremental/helpers.sql", "name": "incremental_upsert", "macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.common_get_delete_insert_merge_sql": {"unique_id": "macro.dbt.common_get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "common_get_delete_insert_merge_sql", "macro_sql": "{% macro common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n );\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.common_get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', macro_namespace = 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/view/view.sql", "original_file_path": "macros/materializations/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/table/table.sql", "original_file_path": "macros/materializations/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.create_indexes", "macro.dbt.persist_docs", "macro.dbt.drop_relation_if_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }},\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nselect\n child.{{ column_name }}\n\nfrom {{ model }} as child\n\nleft join {{ to }} as parent\n on child.{{ column_name }} = parent.{{ field }}\n\nwhere child.{{ column_name }} is not null\n and parent.{{ field }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by 1\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1626853293}}, "docs": {"jaffle_shop.__overview__": {"unique_id": "jaffle_shop.__overview__", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "overview.md", "original_file_path": "models/overview.md", "name": "__overview__", "block_contents": "## Data Documentation for Jaffle Shop\n\n`jaffle_shop` is a fictional ecommerce store.\n\nThis [dbt](https://www.getdbt.com/) project is for testing out code.\n\nThe source code can be found [here](https://github.com/clrcrl/jaffle_shop)."}, "jaffle_shop.orders_status": {"unique_id": "jaffle_shop.orders_status", "package_name": "jaffle_shop", "root_path": "/tmp/dbt-metabase/sandbox", "path": "docs.md", "original_file_path": "models/docs.md", "name": "orders_status", "block_contents": "Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |"}, "dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--models` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [chat](https://community.getdbt.com/) on Slack for live questions and support."}}, "exposures": {}, "selectors": {}, "disabled": [], "parent_map": {"model.jaffle_shop.orders": ["model.jaffle_shop.stg_orders", "model.jaffle_shop.stg_payments"], "model.jaffle_shop.customers": ["model.jaffle_shop.stg_customers", "model.jaffle_shop.stg_orders", "model.jaffle_shop.stg_payments"], "model.jaffle_shop.stg_orders": ["seed.jaffle_shop.raw_orders"], "model.jaffle_shop.stg_payments": ["seed.jaffle_shop.raw_payments"], "model.jaffle_shop.stg_customers": ["seed.jaffle_shop.raw_customers"], "seed.jaffle_shop.raw_customers": [], "seed.jaffle_shop.raw_payments": [], "seed.jaffle_shop.raw_orders": [], "test.jaffle_shop.unique_customers_customer_id.d48e126d80": ["model.jaffle_shop.customers"], "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": ["model.jaffle_shop.customers"], "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": ["model.jaffle_shop.orders"], "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": ["model.jaffle_shop.customers", "model.jaffle_shop.orders"], "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": ["model.jaffle_shop.orders"], "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": ["model.jaffle_shop.orders"], "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": ["model.jaffle_shop.stg_customers"], "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": ["model.jaffle_shop.stg_customers"], "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": ["model.jaffle_shop.stg_orders"], "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": ["model.jaffle_shop.stg_orders"], "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": ["model.jaffle_shop.stg_orders"], "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": ["model.jaffle_shop.stg_payments"], "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": ["model.jaffle_shop.stg_payments"], "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": ["model.jaffle_shop.stg_payments"]}, "child_map": {"model.jaffle_shop.orders": ["test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93", "test.jaffle_shop.not_null_orders_amount.f7bae8de1b", "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa", "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47", "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042", "test.jaffle_shop.not_null_orders_customer_id.70722cc05f", "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88", "test.jaffle_shop.not_null_orders_order_id.4daff5eed7", "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", "test.jaffle_shop.unique_orders_order_id.0d77ddcf59"], "model.jaffle_shop.customers": ["test.jaffle_shop.not_null_customers_customer_id.923d2d910a", "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", "test.jaffle_shop.unique_customers_customer_id.d48e126d80"], "model.jaffle_shop.stg_orders": ["model.jaffle_shop.customers", "model.jaffle_shop.orders", "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f", "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90", "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48"], "model.jaffle_shop.stg_payments": ["model.jaffle_shop.customers", "model.jaffle_shop.orders", "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081", "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012", "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6"], "model.jaffle_shop.stg_customers": ["model.jaffle_shop.customers", "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1", "test.jaffle_shop.unique_stg_customers_customer_id.5530022331"], "seed.jaffle_shop.raw_customers": ["model.jaffle_shop.stg_customers"], "seed.jaffle_shop.raw_payments": ["model.jaffle_shop.stg_payments"], "seed.jaffle_shop.raw_orders": ["model.jaffle_shop.stg_orders"], "test.jaffle_shop.unique_customers_customer_id.d48e126d80": [], "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": [], "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": [], "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": [], "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": [], "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": [], "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": [], "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": [], "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": [], "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": [], "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": [], "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": [], "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": [], "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": [], "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": [], "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": [], "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": [], "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": [], "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": [], "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": []}} diff --git a/tests/fixtures/manifest.json b/tests/fixtures/manifest.json new file mode 100644 index 00000000..ead8cc04 --- /dev/null +++ b/tests/fixtures/manifest.json @@ -0,0 +1,6081 @@ +{ + "metadata": { + "dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v2.json", + "dbt_version": "0.20.0", + "generated_at": "2021-07-21T07:41:33.196162Z", + "invocation_id": "425a0ecf-fdf8-4f90-a96d-e094466d3853", + "env": {}, + "project_id": "06e5b98c2db46f8a72cc4f66410e9b3b", + "user_id": "aa538d43-e1f3-44a7-8a02-ab1328c70052", + "send_anonymous_usage_stats": true, + "adapter_type": "postgres" + }, + "nodes": { + "model.jaffle_shop.orders": { + "raw_sql": "{% set payment_methods = ['credit_card', 'coupon', 'bank_transfer', 'gift_card'] %}\n\nwith orders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\npayments as (\n\n select * from {{ ref('stg_payments') }}\n\n),\n\norder_payments as (\n\n select\n order_id,\n\n {% for payment_method in payment_methods -%}\n sum(case when payment_method = '{{ payment_method }}' then amount else 0 end) as {{ payment_method }}_amount,\n {% endfor -%}\n\n sum(amount) as total_amount\n\n from payments\n\n group by 1\n\n),\n\nfinal as (\n\n select\n orders.order_id,\n orders.customer_id,\n orders.order_date,\n orders.status,\n\n {% for payment_method in payment_methods -%}\n\n order_payments.{{ payment_method }}_amount,\n\n {% endfor -%}\n\n order_payments.total_amount as amount\n\n from orders\n\n left join order_payments using (order_id)\n\n)\n\nselect * from final", + "compiled": true, + "resource_type": "model", + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.create_indexes", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ], + "nodes": [ + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "table", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "orders" + ], + "unique_id": "model.jaffle_shop.orders", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "orders.sql", + "original_file_path": "models/orders.sql", + "name": "orders", + "alias": "orders", + "checksum": { + "name": "sha256", + "checksum": "ec3e8884f18110dd6d9b1ababdd85a6c04bf665ee0f57cade273e442f90e9994" + }, + "tags": [], + "refs": [ + [ + "stg_orders" + ], + [ + "stg_payments" + ] + ], + "sources": [], + "description": "This table has basic information about orders, as well as some derived facts based on payments", + "columns": { + "order_id": { + "name": "order_id", + "description": "This is a unique identifier for an order", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "customer_id": { + "name": "customer_id", + "description": "Foreign key to the customers table", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "order_date": { + "name": "order_date", + "description": "Date (UTC) that the order was placed", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "amount": { + "name": "amount", + "description": "Total amount (AUD) of the order", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "credit_card_amount": { + "name": "credit_card_amount", + "description": "Amount of the order (AUD) paid for by credit card", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "coupon_amount": { + "name": "coupon_amount", + "description": "Amount of the order (AUD) paid for by coupon", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "bank_transfer_amount": { + "name": "bank_transfer_amount", + "description": "Amount of the order (AUD) paid for by bank transfer", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "gift_card_amount": { + "name": "gift_card_amount", + "description": "Amount of the order (AUD) paid for by gift card", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + } + }, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": "jaffle_shop://models/schema.yml", + "compiled_path": "target/compiled/jaffle_shop/models/orders.sql", + "build_path": "target/run/jaffle_shop/models/orders.sql", + "deferred": false, + "unrendered_config": { + "materialized": "table" + }, + "created_at": 1626853293, + "compiled_sql": "\n\nwith orders as (\n\n select * from \"test\".\"public\".\"stg_orders\"\n\n),\n\npayments as (\n\n select * from \"test\".\"public\".\"stg_payments\"\n\n),\n\norder_payments as (\n\n select\n order_id,\n\n sum(case when payment_method = 'credit_card' then amount else 0 end) as credit_card_amount,\n sum(case when payment_method = 'coupon' then amount else 0 end) as coupon_amount,\n sum(case when payment_method = 'bank_transfer' then amount else 0 end) as bank_transfer_amount,\n sum(case when payment_method = 'gift_card' then amount else 0 end) as gift_card_amount,\n sum(amount) as total_amount\n\n from payments\n\n group by 1\n\n),\n\nfinal as (\n\n select\n orders.order_id,\n orders.customer_id,\n orders.order_date,\n orders.status,\n\n order_payments.credit_card_amount,\n\n order_payments.coupon_amount,\n\n order_payments.bank_transfer_amount,\n\n order_payments.gift_card_amount,\n\n order_payments.total_amount as amount\n\n from orders\n\n left join order_payments using (order_id)\n\n)\n\nselect * from final", + "extra_ctes_injected": true, + "extra_ctes": [], + "relation_name": "\"test\".\"public\".\"orders\"" + }, + "model.jaffle_shop.customers": { + "raw_sql": "with customers as (\n\n select * from {{ ref('stg_customers') }}\n\n),\n\norders as (\n\n select * from {{ ref('stg_orders') }}\n\n),\n\npayments as (\n\n select * from {{ ref('stg_payments') }}\n\n),\n\ncustomer_orders as (\n\n select\n customer_id,\n\n min(order_date) as first_order,\n max(order_date) as most_recent_order,\n count(order_id) as number_of_orders\n from orders\n\n group by 1\n\n),\n\ncustomer_payments as (\n\n select\n orders.customer_id,\n sum(amount) as total_amount\n\n from payments\n\n left join orders using (order_id)\n\n group by 1\n\n),\n\nfinal as (\n\n select\n customers.customer_id,\n customers.first_name,\n customers.last_name,\n customer_orders.first_order,\n customer_orders.most_recent_order,\n customer_orders.number_of_orders,\n customer_payments.total_amount as customer_lifetime_value\n\n from customers\n\n left join customer_orders using (customer_id)\n\n left join customer_payments using (customer_id)\n\n)\n\nselect * from final", + "compiled": true, + "resource_type": "model", + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.create_indexes", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ], + "nodes": [ + "model.jaffle_shop.stg_customers", + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "table", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "customers" + ], + "unique_id": "model.jaffle_shop.customers", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "customers.sql", + "original_file_path": "models/customers.sql", + "name": "customers", + "alias": "customers", + "checksum": { + "name": "sha256", + "checksum": "7f193a2c3af2faa53e0bb7b75d2663f39db8c6b3913e9cafd245dc62f98a8d09" + }, + "tags": [], + "refs": [ + [ + "stg_customers" + ], + [ + "stg_orders" + ], + [ + "stg_payments" + ] + ], + "sources": [], + "description": "This table has basic information about a customer, as well as some derived facts based on a customer's orders", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "This is a unique identifier for a customer", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "first_name": { + "name": "first_name", + "description": "Customer's first name. PII.", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "last_name": { + "name": "last_name", + "description": "Customer's last name. PII.", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "first_order": { + "name": "first_order", + "description": "Date (UTC) of a customer's first order", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "most_recent_order": { + "name": "most_recent_order", + "description": "Date (UTC) of a customer's most recent order", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "number_of_orders": { + "name": "number_of_orders", + "description": "Count of the number of orders a customer has placed", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "customer_lifetime_value": { + "name": "customer_lifetime_value", + "description": "Total value (AUD) of a customer's orders", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + } + }, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": "jaffle_shop://models/schema.yml", + "compiled_path": "target/compiled/jaffle_shop/models/customers.sql", + "build_path": "target/run/jaffle_shop/models/customers.sql", + "deferred": false, + "unrendered_config": { + "materialized": "table" + }, + "created_at": 1626853293, + "compiled_sql": "with customers as (\n\n select * from \"test\".\"public\".\"stg_customers\"\n\n),\n\norders as (\n\n select * from \"test\".\"public\".\"stg_orders\"\n\n),\n\npayments as (\n\n select * from \"test\".\"public\".\"stg_payments\"\n\n),\n\ncustomer_orders as (\n\n select\n customer_id,\n\n min(order_date) as first_order,\n max(order_date) as most_recent_order,\n count(order_id) as number_of_orders\n from orders\n\n group by 1\n\n),\n\ncustomer_payments as (\n\n select\n orders.customer_id,\n sum(amount) as total_amount\n\n from payments\n\n left join orders using (order_id)\n\n group by 1\n\n),\n\nfinal as (\n\n select\n customers.customer_id,\n customers.first_name,\n customers.last_name,\n customer_orders.first_order,\n customer_orders.most_recent_order,\n customer_orders.number_of_orders,\n customer_payments.total_amount as customer_lifetime_value\n\n from customers\n\n left join customer_orders using (customer_id)\n\n left join customer_payments using (customer_id)\n\n)\n\nselect * from final", + "extra_ctes_injected": true, + "extra_ctes": [], + "relation_name": "\"test\".\"public\".\"customers\"" + }, + "model.jaffle_shop.stg_orders": { + "raw_sql": "with source as (\n\n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_orders') }}\n\n),\n\nrenamed as (\n\n select\n id as order_id,\n user_id as customer_id,\n order_date,\n status\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "resource_type": "model", + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ], + "nodes": [ + "seed.jaffle_shop.raw_orders" + ] + }, + "config": { + "enabled": true, + "materialized": "view", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "staging", + "stg_orders" + ], + "unique_id": "model.jaffle_shop.stg_orders", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "staging/stg_orders.sql", + "original_file_path": "models/staging/stg_orders.sql", + "name": "stg_orders", + "alias": "stg_orders", + "checksum": { + "name": "sha256", + "checksum": "afffa9cbc57e5fd2cf5898ebf571d444a62c9d6d7929d8133d30567fb9a2ce97" + }, + "tags": [], + "refs": [ + [ + "raw_orders" + ] + ], + "sources": [], + "description": "", + "columns": { + "order_id": { + "name": "order_id", + "description": "", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "status": { + "name": "status", + "description": "", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + } + }, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": "jaffle_shop://models/staging/schema.yml", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_orders.sql", + "build_path": "target/run/jaffle_shop/models/staging/stg_orders.sql", + "deferred": false, + "unrendered_config": { + "materialized": "view" + }, + "created_at": 1626853293, + "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_orders\"\n\n),\n\nrenamed as (\n\n select\n id as order_id,\n user_id as customer_id,\n order_date,\n status\n\n from source\n\n)\n\nselect * from renamed", + "extra_ctes_injected": true, + "extra_ctes": [], + "relation_name": "\"test\".\"public\".\"stg_orders\"" + }, + "model.jaffle_shop.stg_payments": { + "raw_sql": "with source as (\n \n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_payments') }}\n\n),\n\nrenamed as (\n\n select\n id as payment_id,\n order_id,\n payment_method,\n\n --`amount` is currently stored in cents, so we convert it to dollars\n amount / 100 as amount\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "resource_type": "model", + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ], + "nodes": [ + "seed.jaffle_shop.raw_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "view", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "staging", + "stg_payments" + ], + "unique_id": "model.jaffle_shop.stg_payments", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "staging/stg_payments.sql", + "original_file_path": "models/staging/stg_payments.sql", + "name": "stg_payments", + "alias": "stg_payments", + "checksum": { + "name": "sha256", + "checksum": "113502ed19f04efb2af0629ff139f57f7463347b6d5218f3b80a8d128cc96852" + }, + "tags": [], + "refs": [ + [ + "raw_payments" + ] + ], + "sources": [], + "description": "", + "columns": { + "payment_id": { + "name": "payment_id", + "description": "", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + }, + "payment_method": { + "name": "payment_method", + "description": "", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + } + }, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": "jaffle_shop://models/staging/schema.yml", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_payments.sql", + "build_path": "target/run/jaffle_shop/models/staging/stg_payments.sql", + "deferred": false, + "unrendered_config": { + "materialized": "view" + }, + "created_at": 1626853293, + "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_payments\"\n\n),\n\nrenamed as (\n\n select\n id as payment_id,\n order_id,\n payment_method,\n\n --`amount` is currently stored in cents, so we convert it to dollars\n amount / 100 as amount\n\n from source\n\n)\n\nselect * from renamed", + "extra_ctes_injected": true, + "extra_ctes": [], + "relation_name": "\"test\".\"public\".\"stg_payments\"" + }, + "model.jaffle_shop.stg_customers": { + "raw_sql": "with source as (\n\n {#-\n Normally we would select from the table here, but we are using seeds to load\n our data in this project\n #}\n select * from {{ ref('raw_customers') }}\n\n),\n\nrenamed as (\n\n select\n id as customer_id,\n first_name,\n last_name\n\n from source\n\n)\n\nselect * from renamed", + "compiled": true, + "resource_type": "model", + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ], + "nodes": [ + "seed.jaffle_shop.raw_customers" + ] + }, + "config": { + "enabled": true, + "materialized": "view", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "staging", + "stg_customers" + ], + "unique_id": "model.jaffle_shop.stg_customers", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "staging/stg_customers.sql", + "original_file_path": "models/staging/stg_customers.sql", + "name": "stg_customers", + "alias": "stg_customers", + "checksum": { + "name": "sha256", + "checksum": "6f18a29204dad1de6dbb0c288144c4990742e0a1e065c3b2a67b5f98334c22ba" + }, + "tags": [], + "refs": [ + [ + "raw_customers" + ] + ], + "sources": [], + "description": "", + "columns": { + "customer_id": { + "name": "customer_id", + "description": "", + "meta": {}, + "data_type": null, + "quote": null, + "tags": [] + } + }, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": "jaffle_shop://models/staging/schema.yml", + "compiled_path": "target/compiled/jaffle_shop/models/staging/stg_customers.sql", + "build_path": "target/run/jaffle_shop/models/staging/stg_customers.sql", + "deferred": false, + "unrendered_config": { + "materialized": "view" + }, + "created_at": 1626853293, + "compiled_sql": "with source as (\n select * from \"test\".\"public\".\"raw_customers\"\n\n),\n\nrenamed as (\n\n select\n id as customer_id,\n first_name,\n last_name\n\n from source\n\n)\n\nselect * from renamed", + "extra_ctes_injected": true, + "extra_ctes": [], + "relation_name": "\"test\".\"public\".\"stg_customers\"" + }, + "seed.jaffle_shop.raw_customers": { + "raw_sql": "", + "resource_type": "seed", + "depends_on": { + "macros": [], + "nodes": [] + }, + "config": { + "enabled": true, + "materialized": "seed", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "quote_columns": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "raw_customers" + ], + "unique_id": "seed.jaffle_shop.raw_customers", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "raw_customers.csv", + "original_file_path": "seeds/raw_customers.csv", + "name": "raw_customers", + "alias": "raw_customers", + "checksum": { + "name": "sha256", + "checksum": "24579b4b26098d43265376f3c50be8b10faf8e8fd95f5508074f10f76a12671d" + }, + "tags": [], + "refs": [], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293 + }, + "seed.jaffle_shop.raw_payments": { + "raw_sql": "", + "resource_type": "seed", + "depends_on": { + "macros": [], + "nodes": [] + }, + "config": { + "enabled": true, + "materialized": "seed", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "quote_columns": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "raw_payments" + ], + "unique_id": "seed.jaffle_shop.raw_payments", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "raw_payments.csv", + "original_file_path": "seeds/raw_payments.csv", + "name": "raw_payments", + "alias": "raw_payments", + "checksum": { + "name": "sha256", + "checksum": "03fd407f3135f84456431a923f22fc185a2154079e210c20b690e3ab11687d11" + }, + "tags": [], + "refs": [], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293 + }, + "seed.jaffle_shop.raw_orders": { + "raw_sql": "", + "resource_type": "seed", + "depends_on": { + "macros": [], + "nodes": [] + }, + "config": { + "enabled": true, + "materialized": "seed", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": null, + "database": null, + "tags": [], + "full_refresh": null, + "quote_columns": null, + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public", + "fqn": [ + "jaffle_shop", + "raw_orders" + ], + "unique_id": "seed.jaffle_shop.raw_orders", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "raw_orders.csv", + "original_file_path": "seeds/raw_orders.csv", + "name": "raw_orders", + "alias": "raw_orders", + "checksum": { + "name": "sha256", + "checksum": "c5f309d84ba32f2a39235c59f2d4f6c855aedba7e215847c957f1a5f2fa80d3e" + }, + "tags": [], + "refs": [], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293 + }, + "test.jaffle_shop.unique_customers_customer_id.d48e126d80": { + "raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('customers') }} where {{config.get('where')}}) customers{% else %}{{ ref('customers') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.customers" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "unique_customers_customer_id" + ], + "unique_id": "test.jaffle_shop.unique_customers_customer_id.d48e126d80", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/unique_customers_customer_id.sql", + "original_file_path": "models/schema.yml", + "name": "unique_customers_customer_id", + "alias": "unique_customers_customer_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "customers" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('customers') }} where {{config.get('where')}}) customers{% else %}{{ ref('customers') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.customers" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_customers_customer_id" + ], + "unique_id": "test.jaffle_shop.not_null_customers_customer_id.923d2d910a", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_customers_customer_id.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_customers_customer_id", + "alias": "not_null_customers_customer_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "customers" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": { + "raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_id", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "unique_orders_order_id" + ], + "unique_id": "test.jaffle_shop.unique_orders_order_id.0d77ddcf59", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/unique_orders_order_id.sql", + "original_file_path": "models/schema.yml", + "name": "unique_orders_order_id", + "alias": "unique_orders_order_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "order_id" + }, + "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_id", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_order_id" + ], + "unique_id": "test.jaffle_shop.not_null_orders_order_id.4daff5eed7", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_order_id.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_order_id", + "alias": "not_null_orders_order_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "order_id" + }, + "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_customer_id" + ], + "unique_id": "test.jaffle_shop.not_null_orders_customer_id.70722cc05f", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_customer_id.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_customer_id", + "alias": "not_null_orders_customer_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": { + "raw_sql": "{{ test_relationships(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "relationships", + "kwargs": { + "to": "ref('customers')", + "field": "customer_id", + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_relationships", + "macro.dbt.default__test_relationships" + ], + "nodes": [ + "model.jaffle_shop.customers", + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "relationships_orders_customer_id__customer_id__ref_customers_" + ], + "unique_id": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/relationships_orders_customer_id__customer_id__ref_customers_.sql", + "original_file_path": "models/schema.yml", + "name": "relationships_orders_customer_id__customer_id__ref_customers_", + "alias": "relationships_orders_customer_id__customer_id__ref_customers_", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "customers" + ], + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": { + "raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758\") }}", + "test_metadata": { + "name": "accepted_values", + "kwargs": { + "values": [ + "placed", + "shipped", + "completed", + "return_pending", + "returned" + ], + "column_name": "status", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_accepted_values", + "macro.dbt.default__test_accepted_values" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758", + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "accepted_values_orders_status__placed__shipped__completed__return_pending__returned" + ], + "unique_id": "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758.sql", + "original_file_path": "models/schema.yml", + "name": "accepted_values_orders_status__placed__shipped__completed__return_pending__returned", + "alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": { + "alias": "accepted_values_orders_1ce6ab157c285f7cd2ac656013faf758" + }, + "created_at": 1626853293, + "column_name": "status" + }, + "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "amount", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_amount" + ], + "unique_id": "test.jaffle_shop.not_null_orders_amount.f7bae8de1b", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_amount.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_amount", + "alias": "not_null_orders_amount", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "amount" + }, + "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "credit_card_amount", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_credit_card_amount" + ], + "unique_id": "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_credit_card_amount.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_credit_card_amount", + "alias": "not_null_orders_credit_card_amount", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "credit_card_amount" + }, + "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "coupon_amount", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_coupon_amount" + ], + "unique_id": "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_coupon_amount.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_coupon_amount", + "alias": "not_null_orders_coupon_amount", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "coupon_amount" + }, + "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "bank_transfer_amount", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_bank_transfer_amount" + ], + "unique_id": "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_bank_transfer_amount.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_bank_transfer_amount", + "alias": "not_null_orders_bank_transfer_amount", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "bank_transfer_amount" + }, + "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "gift_card_amount", + "model": "{% if config.get('where') %}(select * from {{ ref('orders') }} where {{config.get('where')}}) orders{% else %}{{ ref('orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_orders_gift_card_amount" + ], + "unique_id": "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_orders_gift_card_amount.sql", + "original_file_path": "models/schema.yml", + "name": "not_null_orders_gift_card_amount", + "alias": "not_null_orders_gift_card_amount", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "gift_card_amount" + }, + "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": { + "raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_customers') }} where {{config.get('where')}}) stg_customers{% else %}{{ ref('stg_customers') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_customers" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "unique_stg_customers_customer_id" + ], + "unique_id": "test.jaffle_shop.unique_stg_customers_customer_id.5530022331", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/unique_stg_customers_customer_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "unique_stg_customers_customer_id", + "alias": "unique_stg_customers_customer_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_customers" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "customer_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_customers') }} where {{config.get('where')}}) stg_customers{% else %}{{ ref('stg_customers') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_customers" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_stg_customers_customer_id" + ], + "unique_id": "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_stg_customers_customer_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "not_null_stg_customers_customer_id", + "alias": "not_null_stg_customers_customer_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_customers" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "customer_id" + }, + "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": { + "raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "order_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "unique_stg_orders_order_id" + ], + "unique_id": "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/unique_stg_orders_order_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "unique_stg_orders_order_id", + "alias": "unique_stg_orders_order_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "order_id" + }, + "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "order_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_stg_orders_order_id" + ], + "unique_id": "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_stg_orders_order_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "not_null_stg_orders_order_id", + "alias": "not_null_stg_orders_order_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "order_id" + }, + "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": { + "raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58\") }}", + "test_metadata": { + "name": "accepted_values", + "kwargs": { + "values": [ + "placed", + "shipped", + "completed", + "return_pending", + "returned" + ], + "column_name": "status", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_orders') }} where {{config.get('where')}}) stg_orders{% else %}{{ ref('stg_orders') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_accepted_values", + "macro.dbt.default__test_accepted_values" + ], + "nodes": [ + "model.jaffle_shop.stg_orders" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58", + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned" + ], + "unique_id": "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58.sql", + "original_file_path": "models/staging/schema.yml", + "name": "accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned", + "alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_orders" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": { + "alias": "accepted_values_stg_orders_4f514bf94b77b7ea437830eec4421c58" + }, + "created_at": 1626853293, + "column_name": "status" + }, + "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": { + "raw_sql": "{{ test_unique(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "unique", + "kwargs": { + "column_name": "payment_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_unique" + ], + "nodes": [ + "model.jaffle_shop.stg_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "unique_stg_payments_payment_id" + ], + "unique_id": "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/unique_stg_payments_payment_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "unique_stg_payments_payment_id", + "alias": "unique_stg_payments_payment_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_payments" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "payment_id" + }, + "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": { + "raw_sql": "{{ test_not_null(**_dbt_schema_test_kwargs) }}", + "test_metadata": { + "name": "not_null", + "kwargs": { + "column_name": "payment_id", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_not_null" + ], + "nodes": [ + "model.jaffle_shop.stg_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": null, + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "not_null_stg_payments_payment_id" + ], + "unique_id": "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/not_null_stg_payments_payment_id.sql", + "original_file_path": "models/staging/schema.yml", + "name": "not_null_stg_payments_payment_id", + "alias": "not_null_stg_payments_payment_id", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_payments" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": {}, + "created_at": 1626853293, + "column_name": "payment_id" + }, + "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": { + "raw_sql": "{{ test_accepted_values(**_dbt_schema_test_kwargs) }}{{ config(alias=\"accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef\") }}", + "test_metadata": { + "name": "accepted_values", + "kwargs": { + "values": [ + "credit_card", + "coupon", + "bank_transfer", + "gift_card" + ], + "column_name": "payment_method", + "model": "{% if config.get('where') %}(select * from {{ ref('stg_payments') }} where {{config.get('where')}}) stg_payments{% else %}{{ ref('stg_payments') }}{% endif %}" + }, + "namespace": null + }, + "resource_type": "test", + "depends_on": { + "macros": [ + "macro.dbt.test_accepted_values", + "macro.dbt.default__test_accepted_values" + ], + "nodes": [ + "model.jaffle_shop.stg_payments" + ] + }, + "config": { + "enabled": true, + "materialized": "test", + "persist_docs": {}, + "vars": {}, + "quoting": {}, + "column_types": {}, + "alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef", + "schema": "dbt_test__audit", + "database": null, + "tags": [], + "full_refresh": null, + "severity": "ERROR", + "store_failures": null, + "where": null, + "limit": null, + "fail_calc": "count(*)", + "warn_if": "!= 0", + "error_if": "!= 0", + "post-hook": [], + "pre-hook": [] + }, + "database": "test", + "schema": "public_dbt_test__audit", + "fqn": [ + "jaffle_shop", + "schema_test", + "accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card" + ], + "unique_id": "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "schema_test/accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef.sql", + "original_file_path": "models/staging/schema.yml", + "name": "accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card", + "alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef", + "checksum": { + "name": "none", + "checksum": "" + }, + "tags": [ + "schema" + ], + "refs": [ + [ + "stg_payments" + ] + ], + "sources": [], + "description": "", + "columns": {}, + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "compiled_path": null, + "build_path": null, + "deferred": false, + "unrendered_config": { + "alias": "accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef" + }, + "created_at": 1626853293, + "column_name": "payment_method" + } + }, + "sources": {}, + "macros": { + "macro.dbt_postgres.postgres__create_table_as": { + "unique_id": "macro.dbt_postgres.postgres__create_table_as", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__create_table_as", + "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__get_create_index_sql": { + "unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__get_create_index_sql", + "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__create_schema": { + "unique_id": "macro.dbt_postgres.postgres__create_schema", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__create_schema", + "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__drop_schema": { + "unique_id": "macro.dbt_postgres.postgres__drop_schema", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__drop_schema", + "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__get_columns_in_relation": { + "unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__get_columns_in_relation", + "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt.sql_convert_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__list_relations_without_caching": { + "unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__list_relations_without_caching", + "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__information_schema_name": { + "unique_id": "macro.dbt_postgres.postgres__information_schema_name", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__information_schema_name", + "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__list_schemas": { + "unique_id": "macro.dbt_postgres.postgres__list_schemas", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__list_schemas", + "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__check_schema_exists": { + "unique_id": "macro.dbt_postgres.postgres__check_schema_exists", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__check_schema_exists", + "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__current_timestamp": { + "unique_id": "macro.dbt_postgres.postgres__current_timestamp", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__current_timestamp", + "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__snapshot_string_as_time": { + "unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__snapshot_string_as_time", + "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__snapshot_get_time": { + "unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__snapshot_get_time", + "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__make_temp_relation": { + "unique_id": "macro.dbt_postgres.postgres__make_temp_relation", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__make_temp_relation", + "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix_length = suffix|length + dtstring|length %}\n {% set relation_max_name_length = 63 %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Temp relation suffix is too long (' ~ suffix|length ~ ' characters). Maximum length is ' ~ (relation_max_name_length - dtstring|length) ~ ' characters.') %}\n {% endif %}\n {% set tmp_identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix ~ dtstring %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres_escape_comment": { + "unique_id": "macro.dbt_postgres.postgres_escape_comment", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres_escape_comment", + "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__alter_relation_comment": { + "unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__alter_relation_comment", + "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres_escape_comment" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__alter_column_comment": { + "unique_id": "macro.dbt_postgres.postgres__alter_column_comment", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/adapters.sql", + "original_file_path": "macros/adapters.sql", + "name": "postgres__alter_column_comment", + "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% for column_name in column_dict %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres_escape_comment" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__get_catalog": { + "unique_id": "macro.dbt_postgres.postgres__get_catalog", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/catalog.sql", + "original_file_path": "macros/catalog.sql", + "name": "postgres__get_catalog", + "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n\n {%- call statement('catalog', fetch_result=True) -%}\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n\n where (\n {%- for schema in schemas -%}\n upper(sch.nspname) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence = 'p' -- [p]ermanent table. Other values are [u]nlogged table, [t]emporary table\n and tbl.relkind in ('r', 'v', 'f', 'p') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table, [m]aterialized view\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres_get_relations": { + "unique_id": "macro.dbt_postgres.postgres_get_relations", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/relations.sql", + "original_file_path": "macros/relations.sql", + "name": "postgres_get_relations", + "macro_sql": "{% macro postgres_get_relations () -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt_postgres.postgres__snapshot_merge_sql": { + "unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", + "package_name": "dbt_postgres", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/postgres", + "path": "macros/materializations/snapshot_merge.sql", + "original_file_path": "macros/materializations/snapshot_merge.sql", + "name": "postgres__snapshot_merge_sql", + "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.statement": { + "unique_id": "macro.dbt.statement", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/core.sql", + "original_file_path": "macros/core.sql", + "name": "statement", + "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.noop_statement": { + "unique_id": "macro.dbt.noop_statement", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/core.sql", + "original_file_path": "macros/core.sql", + "name": "noop_statement", + "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_columns_in_query": { + "unique_id": "macro.dbt.get_columns_in_query", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "get_columns_in_query", + "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__get_columns_in_query" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_columns_in_query": { + "unique_id": "macro.dbt.default__get_columns_in_query", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__get_columns_in_query", + "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_schema": { + "unique_id": "macro.dbt.create_schema", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "create_schema", + "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__create_schema" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_schema": { + "unique_id": "macro.dbt.default__create_schema", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__create_schema", + "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.drop_schema": { + "unique_id": "macro.dbt.drop_schema", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "drop_schema", + "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema')(relation) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__drop_schema" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__drop_schema": { + "unique_id": "macro.dbt.default__drop_schema", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__drop_schema", + "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_table_as": { + "unique_id": "macro.dbt.create_table_as", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "create_table_as", + "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as')(temporary, relation, sql) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__create_table_as" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_table_as": { + "unique_id": "macro.dbt.default__create_table_as", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__create_table_as", + "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_create_index_sql": { + "unique_id": "macro.dbt.get_create_index_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "get_create_index_sql", + "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql')(relation, index_dict)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__get_create_index_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_create_index_sql": { + "unique_id": "macro.dbt.default__get_create_index_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__get_create_index_sql", + "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_indexes": { + "unique_id": "macro.dbt.create_indexes", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "create_indexes", + "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes')(relation) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__create_indexes" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_indexes": { + "unique_id": "macro.dbt.default__create_indexes", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__create_indexes", + "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_create_index_sql", + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_view_as": { + "unique_id": "macro.dbt.create_view_as", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "create_view_as", + "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as')(relation, sql) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__create_view_as" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_view_as": { + "unique_id": "macro.dbt.default__create_view_as", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__create_view_as", + "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_catalog": { + "unique_id": "macro.dbt.get_catalog", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "get_catalog", + "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog')(information_schema, schemas)) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__get_catalog" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_catalog": { + "unique_id": "macro.dbt.default__get_catalog", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__get_catalog", + "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_columns_in_relation": { + "unique_id": "macro.dbt.get_columns_in_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "get_columns_in_relation", + "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation')(relation)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__get_columns_in_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.sql_convert_columns_in_relation": { + "unique_id": "macro.dbt.sql_convert_columns_in_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "sql_convert_columns_in_relation", + "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_columns_in_relation": { + "unique_id": "macro.dbt.default__get_columns_in_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__get_columns_in_relation", + "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.alter_column_type": { + "unique_id": "macro.dbt.alter_column_type", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "alter_column_type", + "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type')(relation, column_name, new_column_type)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__alter_column_type" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.alter_column_comment": { + "unique_id": "macro.dbt.alter_column_comment", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "alter_column_comment", + "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment')(relation, column_dict)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__alter_column_comment" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__alter_column_comment": { + "unique_id": "macro.dbt.default__alter_column_comment", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__alter_column_comment", + "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.alter_relation_comment": { + "unique_id": "macro.dbt.alter_relation_comment", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "alter_relation_comment", + "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment')(relation, relation_comment)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__alter_relation_comment" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__alter_relation_comment": { + "unique_id": "macro.dbt.default__alter_relation_comment", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__alter_relation_comment", + "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.persist_docs": { + "unique_id": "macro.dbt.persist_docs", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "persist_docs", + "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__persist_docs" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__persist_docs": { + "unique_id": "macro.dbt.default__persist_docs", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__persist_docs", + "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.run_query", + "macro.dbt.alter_relation_comment", + "macro.dbt.alter_column_comment" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__alter_column_type": { + "unique_id": "macro.dbt.default__alter_column_type", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__alter_column_type", + "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.drop_relation": { + "unique_id": "macro.dbt.drop_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "drop_relation", + "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation')(relation)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__drop_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__drop_relation": { + "unique_id": "macro.dbt.default__drop_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__drop_relation", + "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.truncate_relation": { + "unique_id": "macro.dbt.truncate_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "truncate_relation", + "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation')(relation)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__truncate_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__truncate_relation": { + "unique_id": "macro.dbt.default__truncate_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__truncate_relation", + "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.rename_relation": { + "unique_id": "macro.dbt.rename_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "rename_relation", + "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation')(from_relation, to_relation)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__rename_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__rename_relation": { + "unique_id": "macro.dbt.default__rename_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__rename_relation", + "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.information_schema_name": { + "unique_id": "macro.dbt.information_schema_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "information_schema_name", + "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name')(database)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__information_schema_name" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__information_schema_name": { + "unique_id": "macro.dbt.default__information_schema_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__information_schema_name", + "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.list_schemas": { + "unique_id": "macro.dbt.list_schemas", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "list_schemas", + "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas')(database)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__list_schemas" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__list_schemas": { + "unique_id": "macro.dbt.default__list_schemas", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__list_schemas", + "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.information_schema_name", + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.check_schema_exists": { + "unique_id": "macro.dbt.check_schema_exists", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "check_schema_exists", + "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists')(information_schema, schema)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__check_schema_exists" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__check_schema_exists": { + "unique_id": "macro.dbt.default__check_schema_exists", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__check_schema_exists", + "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.run_query" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.list_relations_without_caching": { + "unique_id": "macro.dbt.list_relations_without_caching", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "list_relations_without_caching", + "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching')(schema_relation)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__list_relations_without_caching" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__list_relations_without_caching": { + "unique_id": "macro.dbt.default__list_relations_without_caching", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__list_relations_without_caching", + "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.current_timestamp": { + "unique_id": "macro.dbt.current_timestamp", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "current_timestamp", + "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp')() }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__current_timestamp" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__current_timestamp": { + "unique_id": "macro.dbt.default__current_timestamp", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__current_timestamp", + "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.collect_freshness": { + "unique_id": "macro.dbt.collect_freshness", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "collect_freshness", + "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__collect_freshness" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__collect_freshness": { + "unique_id": "macro.dbt.default__collect_freshness", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__collect_freshness", + "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement", + "macro.dbt.current_timestamp" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.make_temp_relation": { + "unique_id": "macro.dbt.make_temp_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "make_temp_relation", + "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation')(base_relation, suffix))}}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__make_temp_relation" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__make_temp_relation": { + "unique_id": "macro.dbt.default__make_temp_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "default__make_temp_relation", + "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.set_sql_header": { + "unique_id": "macro.dbt.set_sql_header", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/adapters/common.sql", + "original_file_path": "macros/adapters/common.sql", + "name": "set_sql_header", + "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.generate_schema_name": { + "unique_id": "macro.dbt.generate_schema_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/get_custom_schema.sql", + "original_file_path": "macros/etc/get_custom_schema.sql", + "name": "generate_schema_name", + "macro_sql": "{% macro generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.generate_schema_name_for_env": { + "unique_id": "macro.dbt.generate_schema_name_for_env", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/get_custom_schema.sql", + "original_file_path": "macros/etc/get_custom_schema.sql", + "name": "generate_schema_name_for_env", + "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.generate_database_name": { + "unique_id": "macro.dbt.generate_database_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/get_custom_database.sql", + "original_file_path": "macros/etc/get_custom_database.sql", + "name": "generate_database_name", + "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name')(custom_database_name, node)) %}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__generate_database_name" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__generate_database_name": { + "unique_id": "macro.dbt.default__generate_database_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/get_custom_database.sql", + "original_file_path": "macros/etc/get_custom_database.sql", + "name": "default__generate_database_name", + "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.convert_datetime": { + "unique_id": "macro.dbt.convert_datetime", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "name": "convert_datetime", + "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.dates_in_range": { + "unique_id": "macro.dbt.dates_in_range", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "name": "dates_in_range", + "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.convert_datetime" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.partition_range": { + "unique_id": "macro.dbt.partition_range", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "name": "partition_range", + "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.dates_in_range" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.py_current_timestring": { + "unique_id": "macro.dbt.py_current_timestring", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/datetime.sql", + "original_file_path": "macros/etc/datetime.sql", + "name": "py_current_timestring", + "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.is_incremental": { + "unique_id": "macro.dbt.is_incremental", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/is_incremental.sql", + "original_file_path": "macros/etc/is_incremental.sql", + "name": "is_incremental", + "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.should_full_refresh" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.run_query": { + "unique_id": "macro.dbt.run_query", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/query.sql", + "original_file_path": "macros/etc/query.sql", + "name": "run_query", + "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.generate_alias_name": { + "unique_id": "macro.dbt.generate_alias_name", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/etc/get_custom_alias.sql", + "original_file_path": "macros/etc/get_custom_alias.sql", + "name": "generate_alias_name", + "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.run_hooks": { + "unique_id": "macro.dbt.run_hooks", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "run_hooks", + "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.column_list": { + "unique_id": "macro.dbt.column_list", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "column_list", + "macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.column_list_for_create_table": { + "unique_id": "macro.dbt.column_list_for_create_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "column_list_for_create_table", + "macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- if not loop.last %},{% endif %}\n {% endfor -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.make_hook_config": { + "unique_id": "macro.dbt.make_hook_config", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "make_hook_config", + "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.before_begin": { + "unique_id": "macro.dbt.before_begin", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "before_begin", + "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.in_transaction": { + "unique_id": "macro.dbt.in_transaction", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "in_transaction", + "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.after_commit": { + "unique_id": "macro.dbt.after_commit", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "after_commit", + "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.make_hook_config" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.drop_relation_if_exists": { + "unique_id": "macro.dbt.drop_relation_if_exists", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "drop_relation_if_exists", + "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.load_relation": { + "unique_id": "macro.dbt.load_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "load_relation", + "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.should_full_refresh": { + "unique_id": "macro.dbt.should_full_refresh", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "should_full_refresh", + "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.should_store_failures": { + "unique_id": "macro.dbt.should_store_failures", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/helpers.sql", + "original_file_path": "macros/materializations/helpers.sql", + "name": "should_store_failures", + "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_test_sql": { + "unique_id": "macro.dbt.get_test_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/test.sql", + "original_file_path": "macros/materializations/test.sql", + "name": "get_test_sql", + "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__get_test_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_test_sql": { + "unique_id": "macro.dbt.default__get_test_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/test.sql", + "original_file_path": "macros/materializations/test.sql", + "name": "default__get_test_sql", + "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_test_default": { + "unique_id": "macro.dbt.materialization_test_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/test.sql", + "original_file_path": "macros/materializations/test.sql", + "name": "materialization_test_default", + "macro_sql": "\n\n{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.should_store_failures", + "macro.dbt.statement", + "macro.dbt.create_table_as", + "macro.dbt.get_test_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_csv_table": { + "unique_id": "macro.dbt.create_csv_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "create_csv_table", + "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__create_csv_table" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.reset_csv_table": { + "unique_id": "macro.dbt.reset_csv_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "reset_csv_table", + "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__reset_csv_table" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.load_csv_rows": { + "unique_id": "macro.dbt.load_csv_rows", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "load_csv_rows", + "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__load_csv_rows" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_csv_table": { + "unique_id": "macro.dbt.default__create_csv_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "default__create_csv_table", + "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__reset_csv_table": { + "unique_id": "macro.dbt.default__reset_csv_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "default__reset_csv_table", + "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.create_csv_table" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_seed_column_quoted_csv": { + "unique_id": "macro.dbt.get_seed_column_quoted_csv", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "get_seed_column_quoted_csv", + "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.basic_load_csv_rows": { + "unique_id": "macro.dbt.basic_load_csv_rows", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "basic_load_csv_rows", + "macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_seed_column_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__load_csv_rows": { + "unique_id": "macro.dbt.default__load_csv_rows", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "default__load_csv_rows", + "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.basic_load_csv_rows" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_seed_default": { + "unique_id": "macro.dbt.materialization_seed_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/seed/seed.sql", + "original_file_path": "macros/materializations/seed/seed.sql", + "name": "materialization_seed_default", + "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.should_full_refresh", + "macro.dbt.run_hooks", + "macro.dbt.reset_csv_table", + "macro.dbt.create_csv_table", + "macro.dbt.load_csv_rows", + "macro.dbt.noop_statement", + "macro.dbt.persist_docs", + "macro.dbt.create_indexes" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_merge_sql": { + "unique_id": "macro.dbt.snapshot_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot_merge.sql", + "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", + "name": "snapshot_merge_sql", + "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__snapshot_merge_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__snapshot_merge_sql": { + "unique_id": "macro.dbt.default__snapshot_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot_merge.sql", + "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", + "name": "default__snapshot_merge_sql", + "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n ;\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_columns": { + "unique_id": "macro.dbt.create_columns", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "create_columns", + "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__create_columns" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__create_columns": { + "unique_id": "macro.dbt.default__create_columns", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "default__create_columns", + "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.statement" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.post_snapshot": { + "unique_id": "macro.dbt.post_snapshot", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "post_snapshot", + "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__post_snapshot" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__post_snapshot": { + "unique_id": "macro.dbt.default__post_snapshot", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "default__post_snapshot", + "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_staging_table": { + "unique_id": "macro.dbt.snapshot_staging_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "snapshot_staging_table", + "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.snapshot_get_time" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.build_snapshot_table": { + "unique_id": "macro.dbt.build_snapshot_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "build_snapshot_table", + "macro_sql": "{% macro build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_or_create_relation": { + "unique_id": "macro.dbt.get_or_create_relation", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "get_or_create_relation", + "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.build_snapshot_staging_table": { + "unique_id": "macro.dbt.build_snapshot_staging_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "build_snapshot_staging_table", + "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.make_temp_relation", + "macro.dbt.snapshot_staging_table", + "macro.dbt.statement", + "macro.dbt.create_table_as" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_snapshot_default": { + "unique_id": "macro.dbt.materialization_snapshot_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/snapshot.sql", + "original_file_path": "macros/materializations/snapshot/snapshot.sql", + "name": "materialization_snapshot_default", + "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.create_schema", + "macro.dbt.get_or_create_relation", + "macro.dbt.run_hooks", + "macro.dbt.strategy_dispatch", + "macro.dbt.build_snapshot_table", + "macro.dbt.create_table_as", + "macro.dbt.build_snapshot_staging_table", + "macro.dbt.create_columns", + "macro.dbt.snapshot_merge_sql", + "macro.dbt.statement", + "macro.dbt.persist_docs", + "macro.dbt.create_indexes", + "macro.dbt.post_snapshot" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.strategy_dispatch": { + "unique_id": "macro.dbt.strategy_dispatch", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "strategy_dispatch", + "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_hash_arguments": { + "unique_id": "macro.dbt.snapshot_hash_arguments", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_hash_arguments", + "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__snapshot_hash_arguments": { + "unique_id": "macro.dbt.default__snapshot_hash_arguments", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "default__snapshot_hash_arguments", + "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_get_time": { + "unique_id": "macro.dbt.snapshot_get_time", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_get_time", + "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__snapshot_get_time" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__snapshot_get_time": { + "unique_id": "macro.dbt.default__snapshot_get_time", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "default__snapshot_get_time", + "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.current_timestamp" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_timestamp_strategy": { + "unique_id": "macro.dbt.snapshot_timestamp_strategy", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_timestamp_strategy", + "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/fishtown-analytics/dbt/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_string_as_time": { + "unique_id": "macro.dbt.snapshot_string_as_time", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_string_as_time", + "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt_postgres.postgres__snapshot_string_as_time" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__snapshot_string_as_time": { + "unique_id": "macro.dbt.default__snapshot_string_as_time", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "default__snapshot_string_as_time", + "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_check_all_get_existing_columns": { + "unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_check_all_get_existing_columns", + "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_columns_in_query" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.snapshot_check_strategy": { + "unique_id": "macro.dbt.snapshot_check_strategy", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/snapshot/strategies.sql", + "original_file_path": "macros/materializations/snapshot/strategies.sql", + "name": "snapshot_check_strategy", + "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.snapshot_get_time", + "macro.dbt.run_query", + "macro.dbt.snapshot_string_as_time", + "macro.dbt.snapshot_check_all_get_existing_columns", + "macro.dbt.snapshot_hash_arguments" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_incremental_default": { + "unique_id": "macro.dbt.materialization_incremental_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/incremental/incremental.sql", + "original_file_path": "macros/materializations/incremental/incremental.sql", + "name": "materialization_incremental_default", + "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% do adapter.drop_relation(intermediate_relation) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.load_relation", + "macro.dbt.run_hooks", + "macro.dbt.create_table_as", + "macro.dbt.should_full_refresh", + "macro.dbt.make_temp_relation", + "macro.dbt.run_query", + "macro.dbt.incremental_upsert", + "macro.dbt.statement", + "macro.dbt.persist_docs", + "macro.dbt.create_indexes" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.incremental_upsert": { + "unique_id": "macro.dbt.incremental_upsert", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/incremental/helpers.sql", + "original_file_path": "macros/materializations/incremental/helpers.sql", + "name": "incremental_upsert", + "macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_merge_sql": { + "unique_id": "macro.dbt.get_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "get_merge_sql", + "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__get_merge_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_delete_insert_merge_sql": { + "unique_id": "macro.dbt.get_delete_insert_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "get_delete_insert_merge_sql", + "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__get_delete_insert_merge_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_insert_overwrite_merge_sql": { + "unique_id": "macro.dbt.get_insert_overwrite_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "get_insert_overwrite_merge_sql", + "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__get_insert_overwrite_merge_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_merge_sql": { + "unique_id": "macro.dbt.default__get_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "default__get_merge_sql", + "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.get_quoted_csv": { + "unique_id": "macro.dbt.get_quoted_csv", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "get_quoted_csv", + "macro_sql": "{% macro get_quoted_csv(column_names) %}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.common_get_delete_insert_merge_sql": { + "unique_id": "macro.dbt.common_get_delete_insert_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "common_get_delete_insert_merge_sql", + "macro_sql": "{% macro common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n );\n\n{%- endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_delete_insert_merge_sql": { + "unique_id": "macro.dbt.default__get_delete_insert_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "default__get_delete_insert_merge_sql", + "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.common_get_delete_insert_merge_sql" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__get_insert_overwrite_merge_sql": { + "unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/common/merge.sql", + "original_file_path": "macros/materializations/common/merge.sql", + "name": "default__get_insert_overwrite_merge_sql", + "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.get_quoted_csv" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.handle_existing_table": { + "unique_id": "macro.dbt.handle_existing_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/view/create_or_replace_view.sql", + "original_file_path": "macros/materializations/view/create_or_replace_view.sql", + "name": "handle_existing_table", + "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', macro_namespace = 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__handle_existing_table" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__handle_existing_table": { + "unique_id": "macro.dbt.default__handle_existing_table", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/view/create_or_replace_view.sql", + "original_file_path": "macros/materializations/view/create_or_replace_view.sql", + "name": "default__handle_existing_table", + "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.create_or_replace_view": { + "unique_id": "macro.dbt.create_or_replace_view", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/view/create_or_replace_view.sql", + "original_file_path": "macros/materializations/view/create_or_replace_view.sql", + "name": "create_or_replace_view", + "macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.handle_existing_table", + "macro.dbt.should_full_refresh", + "macro.dbt.statement", + "macro.dbt.create_view_as" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_view_default": { + "unique_id": "macro.dbt.materialization_view_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/view/view.sql", + "original_file_path": "macros/materializations/view/view.sql", + "name": "materialization_view_default", + "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.create_view_as", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.materialization_table_default": { + "unique_id": "macro.dbt.materialization_table_default", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/materializations/table/table.sql", + "original_file_path": "macros/materializations/table/table.sql", + "name": "materialization_table_default", + "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.run_hooks", + "macro.dbt.statement", + "macro.dbt.create_table_as", + "macro.dbt.create_indexes", + "macro.dbt.persist_docs", + "macro.dbt.drop_relation_if_exists" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__test_unique": { + "unique_id": "macro.dbt.default__test_unique", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/unique.sql", + "original_file_path": "macros/schema_tests/unique.sql", + "name": "default__test_unique", + "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }},\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.test_unique": { + "unique_id": "macro.dbt.test_unique", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/unique.sql", + "original_file_path": "macros/schema_tests/unique.sql", + "name": "test_unique", + "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique') %}\n {{ macro(model, column_name) }}\n{% endtest %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__test_unique" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__test_not_null": { + "unique_id": "macro.dbt.default__test_not_null", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/not_null.sql", + "original_file_path": "macros/schema_tests/not_null.sql", + "name": "default__test_not_null", + "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.test_not_null": { + "unique_id": "macro.dbt.test_not_null", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/not_null.sql", + "original_file_path": "macros/schema_tests/not_null.sql", + "name": "test_not_null", + "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null') %}\n {{ macro(model, column_name) }}\n{% endtest %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__test_not_null" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__test_relationships": { + "unique_id": "macro.dbt.default__test_relationships", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/relationships.sql", + "original_file_path": "macros/schema_tests/relationships.sql", + "name": "default__test_relationships", + "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nselect\n child.{{ column_name }}\n\nfrom {{ model }} as child\n\nleft join {{ to }} as parent\n on child.{{ column_name }} = parent.{{ field }}\n\nwhere child.{{ column_name }} is not null\n and parent.{{ field }} is null\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.test_relationships": { + "unique_id": "macro.dbt.test_relationships", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/relationships.sql", + "original_file_path": "macros/schema_tests/relationships.sql", + "name": "test_relationships", + "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__test_relationships" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.default__test_accepted_values": { + "unique_id": "macro.dbt.default__test_accepted_values", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/accepted_values.sql", + "original_file_path": "macros/schema_tests/accepted_values.sql", + "name": "default__test_accepted_values", + "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by 1\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + }, + "macro.dbt.test_accepted_values": { + "unique_id": "macro.dbt.test_accepted_values", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "macros/schema_tests/accepted_values.sql", + "original_file_path": "macros/schema_tests/accepted_values.sql", + "name": "test_accepted_values", + "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", + "resource_type": "macro", + "tags": [], + "depends_on": { + "macros": [ + "macro.dbt.default__test_accepted_values" + ] + }, + "description": "", + "meta": {}, + "docs": { + "show": true + }, + "patch_path": null, + "arguments": [], + "created_at": 1626853293 + } + }, + "docs": { + "jaffle_shop.__overview__": { + "unique_id": "jaffle_shop.__overview__", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "overview.md", + "original_file_path": "models/overview.md", + "name": "__overview__", + "block_contents": "## Data Documentation for Jaffle Shop\n\n`jaffle_shop` is a fictional ecommerce store.\n\nThis [dbt](https://www.getdbt.com/) project is for testing out code.\n\nThe source code can be found [here](https://github.com/clrcrl/jaffle_shop)." + }, + "jaffle_shop.orders_status": { + "unique_id": "jaffle_shop.orders_status", + "package_name": "jaffle_shop", + "root_path": "/tmp/dbt-metabase/sandbox", + "path": "docs.md", + "original_file_path": "models/docs.md", + "name": "orders_status", + "block_contents": "Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |" + }, + "dbt.__overview__": { + "unique_id": "dbt.__overview__", + "package_name": "dbt", + "root_path": "/tmp/dbt-metabase/.venv/lib/python3.8/site-packages/dbt/include/global_project", + "path": "overview.md", + "original_file_path": "docs/overview.md", + "name": "__overview__", + "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--models` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [chat](https://community.getdbt.com/) on Slack for live questions and support." + } + }, + "exposures": {}, + "selectors": {}, + "disabled": [], + "parent_map": { + "model.jaffle_shop.orders": [ + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_payments" + ], + "model.jaffle_shop.customers": [ + "model.jaffle_shop.stg_customers", + "model.jaffle_shop.stg_orders", + "model.jaffle_shop.stg_payments" + ], + "model.jaffle_shop.stg_orders": [ + "seed.jaffle_shop.raw_orders" + ], + "model.jaffle_shop.stg_payments": [ + "seed.jaffle_shop.raw_payments" + ], + "model.jaffle_shop.stg_customers": [ + "seed.jaffle_shop.raw_customers" + ], + "seed.jaffle_shop.raw_customers": [], + "seed.jaffle_shop.raw_payments": [], + "seed.jaffle_shop.raw_orders": [], + "test.jaffle_shop.unique_customers_customer_id.d48e126d80": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": [ + "model.jaffle_shop.customers" + ], + "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": [ + "model.jaffle_shop.customers", + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": [ + "model.jaffle_shop.orders" + ], + "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": [ + "model.jaffle_shop.stg_customers" + ], + "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": [ + "model.jaffle_shop.stg_customers" + ], + "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": [ + "model.jaffle_shop.stg_payments" + ], + "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": [ + "model.jaffle_shop.stg_payments" + ], + "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": [ + "model.jaffle_shop.stg_payments" + ] + }, + "child_map": { + "model.jaffle_shop.orders": [ + "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93", + "test.jaffle_shop.not_null_orders_amount.f7bae8de1b", + "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa", + "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47", + "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042", + "test.jaffle_shop.not_null_orders_customer_id.70722cc05f", + "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88", + "test.jaffle_shop.not_null_orders_order_id.4daff5eed7", + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", + "test.jaffle_shop.unique_orders_order_id.0d77ddcf59" + ], + "model.jaffle_shop.customers": [ + "test.jaffle_shop.not_null_customers_customer_id.923d2d910a", + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4", + "test.jaffle_shop.unique_customers_customer_id.d48e126d80" + ], + "model.jaffle_shop.stg_orders": [ + "model.jaffle_shop.customers", + "model.jaffle_shop.orders", + "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f", + "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90", + "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48" + ], + "model.jaffle_shop.stg_payments": [ + "model.jaffle_shop.customers", + "model.jaffle_shop.orders", + "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081", + "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012", + "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6" + ], + "model.jaffle_shop.stg_customers": [ + "model.jaffle_shop.customers", + "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1", + "test.jaffle_shop.unique_stg_customers_customer_id.5530022331" + ], + "seed.jaffle_shop.raw_customers": [ + "model.jaffle_shop.stg_customers" + ], + "seed.jaffle_shop.raw_payments": [ + "model.jaffle_shop.stg_payments" + ], + "seed.jaffle_shop.raw_orders": [ + "model.jaffle_shop.stg_orders" + ], + "test.jaffle_shop.unique_customers_customer_id.d48e126d80": [], + "test.jaffle_shop.not_null_customers_customer_id.923d2d910a": [], + "test.jaffle_shop.unique_orders_order_id.0d77ddcf59": [], + "test.jaffle_shop.not_null_orders_order_id.4daff5eed7": [], + "test.jaffle_shop.not_null_orders_customer_id.70722cc05f": [], + "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_customers_.e153c026e4": [], + "test.jaffle_shop.accepted_values_orders_status__placed__shipped__completed__return_pending__returned.2e6d271b93": [], + "test.jaffle_shop.not_null_orders_amount.f7bae8de1b": [], + "test.jaffle_shop.not_null_orders_credit_card_amount.f6f7978042": [], + "test.jaffle_shop.not_null_orders_coupon_amount.edd08a4b47": [], + "test.jaffle_shop.not_null_orders_bank_transfer_amount.402a8a1daa": [], + "test.jaffle_shop.not_null_orders_gift_card_amount.6205906a88": [], + "test.jaffle_shop.unique_stg_customers_customer_id.5530022331": [], + "test.jaffle_shop.not_null_stg_customers_customer_id.4ab9034fe1": [], + "test.jaffle_shop.unique_stg_orders_order_id.99e62d7d48": [], + "test.jaffle_shop.not_null_stg_orders_order_id.052f14ae90": [], + "test.jaffle_shop.accepted_values_stg_orders_status__placed__shipped__completed__return_pending__returned.1b7358ad3f": [], + "test.jaffle_shop.unique_stg_payments_payment_id.5f5522e7d6": [], + "test.jaffle_shop.not_null_stg_payments_payment_id.ece096e012": [], + "test.jaffle_shop.accepted_values_stg_payments_payment_method__credit_card__coupon__bank_transfer__gift_card.59d3da1081": [] + } +} diff --git a/tests/fixtures/mock_api/api/card.json b/tests/fixtures/mock_api/api/card.json deleted file mode 100644 index 439d6b4e..00000000 --- a/tests/fixtures/mock_api/api/card.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 40.10050506338833, "max": 131.0, "sd": 26.119172295224672, "avg": 32.15384615384615}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 34, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 13.17157287525381, "q3": 34.732050807568875, "max": 99.0, "sd": 17.628392521514144, "avg": 26.39102564102564}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.456526Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 9, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.208516Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.189846Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 33, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 17.0, "q3": 55.93725393319377, "max": 129.0, "sd": 25.492672054973276, "avg": 36.34782608695652}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 33.53589838486224, "max": 65.0, "sd": 17.057530000270994, "avg": 27.342391304347824}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.665585Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 11, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.544961Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.52841Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.000946Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 42, null], -30, "day"], "aggregation": [["count"]]}}, "id": 4, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.545719Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:37.535187Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.157282Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 39, null], -30, "day"], "aggregation": [["count"]]}}, "id": 5, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.641827Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:37.630969Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "name": "customer_lifetime_value", "field_ref": ["field", 41, {"binning": {"strategy": "num-bins", "min-value": 0.0, "max-value": 100.0, "num-bins": 8, "bin-width": 12.5}}], "effective_type": "type/BigInteger", "id": 41, "display_name": "customer_lifetime_value", "fingerprint": {"global": {"distinct-count": 36, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 13.464101615137753, "q3": 35.46410161513776, "max": 99.0, "sd": 18.812245525263663, "avg": 26.967741935483872}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 3.0, "q3": 17.5, "max": 38.0, "sd": 12.294017127971522, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by customer_lifetime_value", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.20895Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 41, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 7, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.870294Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["customer_lifetime_value"], "graph.colors": ["#A6E7F3"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:37.858387Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": "type/Quantity", "coercion_strategy": null, "name": "number_of_orders", "field_ref": ["field", 40, {"binning": {"strategy": "num-bins", "min-value": 1.0, "max-value": 5.0, "num-bins": 8, "bin-width": 0.5}}], "effective_type": "type/BigInteger", "id": 40, "display_name": "number_of_orders", "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.0901356485315583, "max": 5.0, "sd": 0.7779687173818424, "avg": 1.596774193548387}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 4.0, "q3": 34.25, "max": 38.0, "sd": 16.492422502470642, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by number_of_orders", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.107313Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 40, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 6, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.76733Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["number_of_orders"], "graph.colors": ["#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:37.754606Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 7, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0200644129064447, "q3": 2.3725029928215275, "max": 7.0, "sd": 1.25650644505132, "avg": 1.9038461538461537}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.019031639883796, "max": 5.0, "sd": 0.7594097162561813, "avg": 1.573717948717949}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": null, "query_type": "query", "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", "creator_id": 1, "updated_at": "2021-07-21T19:19:58.848286Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 1, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:00:47.4892Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": null, "favorite": false, "created_at": "2021-07-21T08:00:47.453351Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.1073874870150486, "q3": 3.0, "max": 5.0, "sd": 1.2643380578934107, "avg": 2.152173913043478}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.019470273980893, "q3": 1.989426104361334, "max": 5.0, "sd": 0.7515349295958083, "avg": 1.596014492753623}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.321381Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 10, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.368218Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.347535Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 7, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0200644129064447, "q3": 2.3725029928215275, "max": 7.0, "sd": 1.25650644505132, "avg": 1.9038461538461537}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.019031639883796, "max": 5.0, "sd": 0.7594097162561813, "avg": 1.573717948717949}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.368004Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 8, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.030503Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.016244Z", "public_uuid": null}, {"description": "Nice KPI", "archived": false, "collection_position": null, "table_id": 6, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0}, "type": {"type/Number": {"min": 99, "q1": 99, "q3": 99, "max": 99, "sd": null, "avg": 99}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": null, "query_type": "query", "name": "Orders, Count", "creator_id": 1, "updated_at": "2021-07-21T08:01:14.290572Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 6, "aggregation": [["count"]]}}, "id": 2, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:14.3056Z"}, "visualization_settings": {"graph.series_labels": ["Number of orders"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": null, "favorite": false, "created_at": "2021-07-21T08:01:14.290572Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 15.782357300628025, "max": 38.0, "sd": 10.488088481701515, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.346492Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 12, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.676704Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.662485Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 11.757359312880714, "max": 38.0, "sd": 10.528871870107588, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.483723Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 13, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.821564Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.808186Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.298221281347036, "q3": 27.5, "max": 38.0, "sd": 12.96148139681572, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.52292Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 15, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.098141Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:39.084258Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 10.25, "q3": 30.5, "max": 38.0, "sd": 12.62933094031509, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.562877Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 14, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.953633Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:38.938688Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.0, "q3": 54.5, "max": 60.0, "sd": 29.280255007997, "avg": 33.333333333333336}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.603496Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 17, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.385031Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:39.371067Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 15.5, "q3": 50.0, "max": 54.0, "sd": 23.35237318418266, "avg": 33.333333333333336}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "creator_id": 1, "updated_at": "2021-07-21T08:01:42.567707Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 16, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.243522Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:39.228965Z", "public_uuid": null}, {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 100.0, "q1": 100.0, "q3": 100.0, "max": 100.0, "sd": null, "avg": 100.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Total customers", "creator_id": 1, "updated_at": "2021-07-21T08:01:41.996Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "aggregation": [["count"]]}}, "id": 3, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.449936Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "favorite": false, "created_at": "2021-07-21T08:01:37.434243Z", "public_uuid": null}] diff --git a/tests/fixtures/mock_api/api/card/1.json b/tests/fixtures/mock_api/api/card/1.json deleted file mode 100644 index 0bf39572..00000000 --- a/tests/fixtures/mock_api/api/card/1.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 7, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0200644129064447, "q3": 2.3725029928215275, "max": 7.0, "sd": 1.25650644505132, "avg": 1.9038461538461537}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.019031639883796, "max": 5.0, "sd": 0.7594097162561813, "avg": 1.573717948717949}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": null, "query_type": "query", "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", "dashboard_count": 0, "creator_id": 1, "updated_at": "2021-07-21T19:19:58.848286Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 1, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:00:47.4892Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": null, "created_at": "2021-07-21T08:00:47.453351Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/10.json b/tests/fixtures/mock_api/api/card/10.json deleted file mode 100644 index 27653396..00000000 --- a/tests/fixtures/mock_api/api/card/10.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.1073874870150486, "q3": 3.0, "max": 5.0, "sd": 1.2643380578934107, "avg": 2.152173913043478}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.019470273980893, "q3": 1.989426104361334, "max": 5.0, "sd": 0.7515349295958083, "avg": 1.596014492753623}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.321381Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 10, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.368218Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.347535Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/11.json b/tests/fixtures/mock_api/api/card/11.json deleted file mode 100644 index e94f187c..00000000 --- a/tests/fixtures/mock_api/api/card/11.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 33, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 17.0, "q3": 55.93725393319377, "max": 129.0, "sd": 25.492672054973276, "avg": 36.34782608695652}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 33.53589838486224, "max": 65.0, "sd": 17.057530000270994, "avg": 27.342391304347824}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.665585Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 11, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.544961Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.52841Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/12.json b/tests/fixtures/mock_api/api/card/12.json deleted file mode 100644 index f03d343d..00000000 --- a/tests/fixtures/mock_api/api/card/12.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 15.782357300628025, "max": 38.0, "sd": 10.488088481701515, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.346492Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 12, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.676704Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.662485Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/13.json b/tests/fixtures/mock_api/api/card/13.json deleted file mode 100644 index 62ec8431..00000000 --- a/tests/fixtures/mock_api/api/card/13.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 11.757359312880714, "max": 38.0, "sd": 10.528871870107588, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.483723Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 13, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.821564Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.808186Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/14.json b/tests/fixtures/mock_api/api/card/14.json deleted file mode 100644 index 29545f0b..00000000 --- a/tests/fixtures/mock_api/api/card/14.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 10.25, "q3": 30.5, "max": 38.0, "sd": 12.62933094031509, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.562877Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 14, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.953633Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.938688Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/15.json b/tests/fixtures/mock_api/api/card/15.json deleted file mode 100644 index 478047ba..00000000 --- a/tests/fixtures/mock_api/api/card/15.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.298221281347036, "q3": 27.5, "max": 38.0, "sd": 12.96148139681572, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.52292Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 15, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.098141Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:39.084258Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/16.json b/tests/fixtures/mock_api/api/card/16.json deleted file mode 100644 index c0a7295c..00000000 --- a/tests/fixtures/mock_api/api/card/16.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 15.5, "q3": 50.0, "max": 54.0, "sd": 23.35237318418266, "avg": 33.333333333333336}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.567707Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 16, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.243522Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:39.228965Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/17.json b/tests/fixtures/mock_api/api/card/17.json deleted file mode 100644 index 4ab89983..00000000 --- a/tests/fixtures/mock_api/api/card/17.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.0, "q3": 54.5, "max": 60.0, "sd": 29.280255007997, "avg": 33.333333333333336}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.603496Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 17, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.385031Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:39.371067Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/2.json b/tests/fixtures/mock_api/api/card/2.json deleted file mode 100644 index 56860914..00000000 --- a/tests/fixtures/mock_api/api/card/2.json +++ /dev/null @@ -1 +0,0 @@ -{"description": "Nice KPI", "archived": false, "collection_position": null, "table_id": 6, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0}, "type": {"type/Number": {"min": 99, "q1": 99, "q3": 99, "max": 99, "sd": null, "avg": 99}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": null, "query_type": "query", "name": "Orders, Count", "dashboard_count": 0, "creator_id": 1, "updated_at": "2021-07-21T08:01:14.290572Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 6, "aggregation": [["count"]]}}, "id": 2, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:14.3056Z"}, "visualization_settings": {"graph.series_labels": ["Number of orders"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": null, "created_at": "2021-07-21T08:01:14.290572Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/3.json b/tests/fixtures/mock_api/api/card/3.json deleted file mode 100644 index ae848b67..00000000 --- a/tests/fixtures/mock_api/api/card/3.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 100.0, "q1": 100.0, "q3": 100.0, "max": 100.0, "sd": null, "avg": 100.0}}}}], "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Total customers", "dashboard_count": 1, "creator_id": 2, "updated_at": "2021-07-21T08:01:41.996Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "aggregation": [["count"]]}}, "id": 3, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.449936Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:37.434243Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/4.json b/tests/fixtures/mock_api/api/card/4.json deleted file mode 100644 index 6e1e89a1..00000000 --- a/tests/fixtures/mock_api/api/card/4.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.000946Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 42, null], -30, "day"], "aggregation": [["count"]]}}, "id": 4, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.545719Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:37.535187Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/5.json b/tests/fixtures/mock_api/api/card/5.json deleted file mode 100644 index aafc109c..00000000 --- a/tests/fixtures/mock_api/api/card/5.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.157282Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 39, null], -30, "day"], "aggregation": [["count"]]}}, "id": 5, "display": "scalar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.641827Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:37.630969Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/6.json b/tests/fixtures/mock_api/api/card/6.json deleted file mode 100644 index 0de6019e..00000000 --- a/tests/fixtures/mock_api/api/card/6.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": "type/Quantity", "coercion_strategy": null, "name": "number_of_orders", "field_ref": ["field", 40, {"binning": {"strategy": "num-bins", "min-value": 1.0, "max-value": 5.0, "num-bins": 8, "bin-width": 0.5}}], "effective_type": "type/BigInteger", "id": 40, "display_name": "number_of_orders", "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.0901356485315583, "max": 5.0, "sd": 0.7779687173818424, "avg": 1.596774193548387}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 4.0, "q3": 34.25, "max": 38.0, "sd": 16.492422502470642, "avg": 20.0}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by number_of_orders", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.107313Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 40, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 6, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.76733Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["number_of_orders"], "graph.colors": ["#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:37.754606Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/7.json b/tests/fixtures/mock_api/api/card/7.json deleted file mode 100644 index a39689ee..00000000 --- a/tests/fixtures/mock_api/api/card/7.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "name": "customer_lifetime_value", "field_ref": ["field", 41, {"binning": {"strategy": "num-bins", "min-value": 0.0, "max-value": 100.0, "num-bins": 8, "bin-width": 12.5}}], "effective_type": "type/BigInteger", "id": 41, "display_name": "customer_lifetime_value", "fingerprint": {"global": {"distinct-count": 36, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 13.464101615137753, "q3": 35.46410161513776, "max": 99.0, "sd": 18.812245525263663, "avg": 26.967741935483872}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 3.0, "q3": 17.5, "max": 38.0, "sd": 12.294017127971522, "avg": 12.5}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by customer_lifetime_value", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.20895Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 41, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 7, "display": "bar", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:37.870294Z"}, "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["customer_lifetime_value"], "graph.colors": ["#A6E7F3"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:37.858387Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/8.json b/tests/fixtures/mock_api/api/card/8.json deleted file mode 100644 index c643e244..00000000 --- a/tests/fixtures/mock_api/api/card/8.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 7, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0200644129064447, "q3": 2.3725029928215275, "max": 7.0, "sd": 1.25650644505132, "avg": 1.9038461538461537}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.019031639883796, "max": 5.0, "sd": 0.7594097162561813, "avg": 1.573717948717949}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.368004Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 8, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.030503Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.016244Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/card/9.json b/tests/fixtures/mock_api/api/card/9.json deleted file mode 100644 index 57bfb1ce..00000000 --- a/tests/fixtures/mock_api/api/card/9.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 40.10050506338833, "max": 131.0, "sd": 26.119172295224672, "avg": 32.15384615384615}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 34, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 13.17157287525381, "q3": 34.732050807568875, "max": 99.0, "sd": 17.628392521514144, "avg": 26.39102564102564}}}}], "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "can_write": true, "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "dashboard_count": 1, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.456526Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 9, "display": "line", "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:38.208516Z"}, "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "collection": {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, "created_at": "2021-07-21T08:01:38.189846Z", "public_uuid": null} diff --git a/tests/fixtures/mock_api/api/collection.json b/tests/fixtures/mock_api/api/collection.json deleted file mode 100644 index cb37621e..00000000 --- a/tests/fixtures/mock_api/api/collection.json +++ /dev/null @@ -1 +0,0 @@ -[{"name": "Our analytics", "id": "root", "parent_id": null, "effective_location": null, "effective_ancestors": [], "can_write": true}, {"authority_level": null, "description": null, "archived": false, "slug": "dbtmetabase_s_personal_collection", "color": "#31698A", "can_write": true, "name": "dbtmetabase's Personal Collection", "personal_owner_id": 1, "id": 1, "location": "/", "namespace": null}, {"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "can_write": true, "name": "A look at your customers table", "personal_owner_id": null, "id": 3, "location": "/2/", "namespace": null}, {"authority_level": null, "description": null, "archived": false, "slug": "automatically_generated_dashboards", "color": "#509EE3", "can_write": true, "name": "Automatically Generated Dashboards", "personal_owner_id": null, "id": 2, "location": "/", "namespace": null}] diff --git a/tests/fixtures/mock_api/api/collection/1.json b/tests/fixtures/mock_api/api/collection/1.json deleted file mode 100644 index 509e1937..00000000 --- a/tests/fixtures/mock_api/api/collection/1.json +++ /dev/null @@ -1 +0,0 @@ -{"authority_level": null, "description": null, "archived": false, "slug": "dbtmetabase_s_personal_collection", "color": "#31698A", "can_write": true, "name": "dbtmetabase's Personal Collection", "personal_owner_id": 1, "effective_ancestors": [{"metabase.models.collection.root/is-root?": true, "name": "Our analytics", "id": "root", "can_write": true}], "effective_location": "/", "parent_id": null, "id": 1, "location": "/", "namespace": null} diff --git a/tests/fixtures/mock_api/api/collection/2.json b/tests/fixtures/mock_api/api/collection/2.json deleted file mode 100644 index f1215f74..00000000 --- a/tests/fixtures/mock_api/api/collection/2.json +++ /dev/null @@ -1 +0,0 @@ -{"authority_level": null, "description": null, "archived": false, "slug": "automatically_generated_dashboards", "color": "#509EE3", "can_write": true, "name": "Automatically Generated Dashboards", "personal_owner_id": null, "effective_ancestors": [{"metabase.models.collection.root/is-root?": true, "name": "Our analytics", "id": "root", "can_write": true}], "effective_location": "/", "parent_id": null, "id": 2, "location": "/", "namespace": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/collection/2/items.json b/tests/fixtures/mock_api/api/collection/2/items.json deleted file mode 100644 index 4a04859c..00000000 --- a/tests/fixtures/mock_api/api/collection/2/items.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": "Automatically generated cards.", "can_write": true, "name": "A look at your customers table", "id": 3, "model": "collection"}] \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/collection/3.json b/tests/fixtures/mock_api/api/collection/3.json deleted file mode 100644 index 0ee8b0d3..00000000 --- a/tests/fixtures/mock_api/api/collection/3.json +++ /dev/null @@ -1 +0,0 @@ -{"authority_level": null, "description": "Automatically generated cards.", "archived": false, "slug": "a_look_at_your_customers_table", "color": "#f9d45c", "can_write": true, "name": "A look at your customers table", "personal_owner_id": null, "effective_ancestors": [{"metabase.models.collection.root/is-root?": true, "name": "Our analytics", "id": "root", "can_write": true}, {"name": "Automatically Generated Dashboards", "id": 2, "can_write": true}], "effective_location": "/2/", "parent_id": 2, "id": 3, "location": "/2/", "namespace": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/collection/3/items.json b/tests/fixtures/mock_api/api/collection/3/items.json deleted file mode 100644 index cd993187..00000000 --- a/tests/fixtures/mock_api/api/collection/3/items.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "collection_position": 1, "name": "A look at your customers table", "id": 1, "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:39.542335Z"}, "favorite": false, "model": "dashboard"}, {"description": null, "collection_position": null, "name": "Customer_lifetime_value over time", "id": 11, "display": "line", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.544961Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Customer_lifetime_value over time", "id": 9, "display": "line", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.208516Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Customers added in the last 30 days", "id": 4, "display": "scalar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:37.545719Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Customers added in the last 30 days", "id": 5, "display": "scalar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:37.641827Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Customers by customer_lifetime_value", "id": 7, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:37.870294Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Customers by number_of_orders", "id": 6, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:37.76733Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Number_of_orders over time", "id": 8, "display": "line", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.030503Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Number_of_orders over time", "id": 10, "display": "line", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.368218Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by day of the week", "id": 12, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.676704Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by day of the week", "id": 13, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.821564Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by month of the year", "id": 15, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:39.098141Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by month of the year", "id": 14, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:38.953633Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by quarter of the year", "id": 17, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:39.385031Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Timestamp by quarter of the year", "id": 16, "display": "bar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:39.243522Z"}, "favorite": false, "model": "card"}, {"description": null, "collection_position": null, "name": "Total customers", "id": 3, "display": "scalar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:37.449936Z"}, "favorite": false, "model": "card"}] diff --git a/tests/fixtures/mock_api/api/collection/root/items.json b/tests/fixtures/mock_api/api/collection/root/items.json deleted file mode 100644 index a9651d89..00000000 --- a/tests/fixtures/mock_api/api/collection/root/items.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "can_write": true, "name": "dbtmetabase's Personal Collection", "id": 1, "model": "collection"}, {"description": null, "can_write": true, "name": "Automatically Generated Dashboards", "id": 2, "model": "collection"}, {"description": null, "collection_position": null, "name": "Customers, Sum of Number Of Orders and Average of Number Of Orders, Grouped by Most Recent Order (day)", "id": 1, "display": "line", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:00:47.4892Z"}, "favorite": false, "model": "card"}, {"description": "Nice KPI", "collection_position": null, "name": "Orders, Count", "id": 2, "display": "scalar", "last-edit-info": {"id": 1, "last_name": "", "first_name": "dbtmetabase", "email": "user@example.com", "timestamp": "2021-07-21T08:01:14.3056Z"}, "favorite": false, "model": "card"}] diff --git a/tests/fixtures/mock_api/api/dashboard.json b/tests/fixtures/mock_api/api/dashboard.json deleted file mode 100644 index 57618588..00000000 --- a/tests/fixtures/mock_api/api/dashboard.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "archived": false, "collection_position": 1, "creator": {"email": "user@example.com", "first_name": "dbtmetabase", "last_login": "2021-07-21T19:25:28.6083Z", "is_qbnewb": false, "is_superuser": true, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase"}, "enable_embedding": false, "collection_id": 3, "show_in_getting_started": false, "name": "A look at your customers table", "caveats": null, "creator_id": 1, "updated_at": "2021-07-21T08:01:37.328519Z", "made_public_by_id": null, "embedding_params": null, "id": 1, "position": null, "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.542335Z"}, "parameters": [{"id": "-1693594175", "type": "date/all-options", "name": "most_recent_order", "slug": "most_recent_order"}, {"id": "381527929", "type": "date/all-options", "name": "first_order", "slug": "first_order"}], "favorite": false, "created_at": "2021-07-21T08:01:37.328519Z", "public_uuid": null, "points_of_interest": null}] diff --git a/tests/fixtures/mock_api/api/dashboard/1.json b/tests/fixtures/mock_api/api/dashboard/1.json deleted file mode 100644 index 146d0c21..00000000 --- a/tests/fixtures/mock_api/api/dashboard/1.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "archived": false, "collection_position": 1, "ordered_cards": [{"sizeX": 18, "series": [], "collection_authority_level": null, "card": {"query_average_duration": null}, "updated_at": "2021-07-21T08:01:37.372373Z", "col": 0, "id": 1, "parameter_mappings": [], "card_id": null, "visualization_settings": {"text": "# Summary", "virtual_card": {"name": null, "display": "text", "dataset_query": {}, "visualization_settings": {}}, "dashcard.background": false, "text.align_vertical": "bottom"}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.372373Z", "sizeY": 2, "row": 0}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 100.0, "q1": 100.0, "q3": 100.0, "max": 100.0, "sd": null, "avg": 100.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Total customers", "query_average_duration": 579, "creator_id": 1, "updated_at": "2021-07-21T08:01:41.996Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "aggregation": [["count"]]}}, "id": 3, "display": "scalar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "created_at": "2021-07-21T08:01:37.434243Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:37.466466Z", "col": 0, "id": 2, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 3}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 3}], "card_id": 3, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.466466Z", "sizeY": 4, "row": 2}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "query_average_duration": 38, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.000946Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 42, null], -30, "day"], "aggregation": [["count"]]}}, "id": 4, "display": "scalar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "created_at": "2021-07-21T08:01:37.535187Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:37.567169Z", "col": 6, "id": 3, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 4}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 4}], "card_id": 4, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.567169Z", "sizeY": 4, "row": 2}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 1, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.0, "max": 0.0, "sd": null, "avg": 0.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers added in the last 30 days", "query_average_duration": 132, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.157282Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "filter": ["time-interval", ["field", 39, null], -30, "day"], "aggregation": [["count"]]}}, "id": 5, "display": "scalar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": []}, "created_at": "2021-07-21T08:01:37.630969Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:37.652919Z", "col": 12, "id": 4, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 5}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 5}], "card_id": 5, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.652919Z", "sizeY": 4, "row": 2}, {"sizeX": 18, "series": [], "collection_authority_level": null, "card": {"query_average_duration": null}, "updated_at": "2021-07-21T08:01:37.686857Z", "col": 0, "id": 5, "parameter_mappings": [], "card_id": null, "visualization_settings": {"text": "# How these customers are distributed", "virtual_card": {"name": null, "display": "text", "dataset_query": {}, "visualization_settings": {}}, "dashcard.background": false, "text.align_vertical": "bottom"}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.686857Z", "sizeY": 2, "row": 6}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": "type/Quantity", "coercion_strategy": null, "name": "number_of_orders", "field_ref": ["field", 40, {"binning": {"strategy": "num-bins", "min-value": 1.0, "max-value": 5.0, "num-bins": 8, "bin-width": 0.5}}], "effective_type": "type/BigInteger", "id": 40, "display_name": "number_of_orders", "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.0901356485315583, "max": 5.0, "sd": 0.7779687173818424, "avg": 1.596774193548387}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 4.0, "q3": 34.25, "max": 38.0, "sd": 16.492422502470642, "avg": 20.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by number_of_orders", "query_average_duration": 321, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.107313Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 40, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 6, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["number_of_orders"], "graph.colors": ["#EF8C8C"]}, "created_at": "2021-07-21T08:01:37.754606Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:37.781517Z", "col": 0, "id": 6, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 6}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 6}], "card_id": 6, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.781517Z", "sizeY": 4, "row": 8}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "name": "customer_lifetime_value", "field_ref": ["field", 41, {"binning": {"strategy": "num-bins", "min-value": 0.0, "max-value": 100.0, "num-bins": 8, "bin-width": 12.5}}], "effective_type": "type/BigInteger", "id": 41, "display_name": "customer_lifetime_value", "fingerprint": {"global": {"distinct-count": 36, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 13.464101615137753, "q3": 35.46410161513776, "max": 99.0, "sd": 18.812245525263663, "avg": 26.967741935483872}}}, "base_type": "type/Decimal"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 3.0, "q3": 17.5, "max": 38.0, "sd": 12.294017127971522, "avg": 12.5}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customers by customer_lifetime_value", "query_average_duration": 163, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.20895Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 41, {"binning": {"strategy": "default"}}]], "aggregation": [["count"]]}}, "id": 7, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["customer_lifetime_value"], "graph.colors": ["#A6E7F3"]}, "created_at": "2021-07-21T08:01:37.858387Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:37.886739Z", "col": 6, "id": 7, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 7}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 7}], "card_id": 7, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.886739Z", "sizeY": 4, "row": 8}, {"sizeX": 18, "series": [], "collection_authority_level": null, "card": {"query_average_duration": null}, "updated_at": "2021-07-21T08:01:37.923226Z", "col": 0, "id": 8, "parameter_mappings": [], "card_id": null, "visualization_settings": {"text": "# These customers across time", "virtual_card": {"name": null, "display": "text", "dataset_query": {}, "visualization_settings": {}}, "dashcard.background": false, "text.align_vertical": "bottom"}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:37.923226Z", "sizeY": 2, "row": 12}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 7, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0200644129064447, "q3": 2.3725029928215275, "max": 7.0, "sd": 1.25650644505132, "avg": 1.9038461538461537}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.019031639883796, "max": 5.0, "sd": 0.7594097162561813, "avg": 1.573717948717949}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "query_average_duration": 1044, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.368004Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 8, "display": "line", "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "created_at": "2021-07-21T08:01:38.016244Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.058235Z", "col": 0, "id": 9, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 8}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 8}], "card_id": 8, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.058235Z", "sizeY": 4, "row": 14}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 40.10050506338833, "max": 131.0, "sd": 26.119172295224672, "avg": 32.15384615384615}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 34, "nil%": 0.01886792452830189}, "type": {"type/Number": {"min": 1.0, "q1": 13.17157287525381, "q3": 34.732050807568875, "max": 99.0, "sd": 17.628392521514144, "avg": 26.39102564102564}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "query_average_duration": 1070, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.456526Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 9, "display": "line", "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "created_at": "2021-07-21T08:01:38.189846Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.245167Z", "col": 6, "id": 10, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 9}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 9}], "card_id": 9, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.245167Z", "sizeY": 4, "row": 14}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.1073874870150486, "q3": 3.0, "max": 5.0, "sd": 1.2643380578934107, "avg": 2.152173913043478}}}}, {"name": "avg", "display_name": "Average of number_of_orders", "base_type": "type/Decimal", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 8, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 1.019470273980893, "q3": 1.989426104361334, "max": 5.0, "sd": 0.7515349295958083, "avg": 1.596014492753623}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Number_of_orders over time", "query_average_duration": 861, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.321381Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 40, null]], ["avg", ["field", 40, null]]]}}, "id": 10, "display": "line", "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#7172AD", "#EF8C8C"]}, "created_at": "2021-07-21T08:01:38.347535Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.41171Z", "col": 12, "id": 11, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 10}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 10}], "card_id": 10, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.41171Z", "sizeY": 4, "row": 14}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Date"}, {"name": "sum", "display_name": "Sum of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 33, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 17.0, "q3": 55.93725393319377, "max": 129.0, "sd": 25.492672054973276, "avg": 36.34782608695652}}}}, {"name": "avg", "display_name": "Average of customer_lifetime_value", "base_type": "type/Decimal", "semantic_type": null, "field_ref": ["aggregation", 1], "fingerprint": {"global": {"distinct-count": 35, "nil%": 0.02127659574468085}, "type": {"type/Number": {"min": 1.0, "q1": 15.0, "q3": 33.53589838486224, "max": 65.0, "sd": 17.057530000270994, "avg": 27.342391304347824}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Customer_lifetime_value over time", "query_average_duration": 843, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.665585Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day"}]], "aggregation": [["sum", ["field", 41, null]], ["avg", ["field", 41, null]]]}}, "id": 11, "display": "line", "visualization_settings": {"graph.series_labels": ["sum", "average"], "graph.metrics": ["sum", "avg"], "graph.dimensions": ["first_order"], "graph.colors": ["#f9d45c", "#F1B556"]}, "created_at": "2021-07-21T08:01:38.52841Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.575083Z", "col": 0, "id": 12, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 11}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 11}], "card_id": 11, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.575083Z", "sizeY": 4, "row": 18}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 15.782357300628025, "max": 38.0, "sd": 10.488088481701515, "avg": 12.5}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "query_average_duration": 277, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.346492Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 12, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:38.662485Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.705264Z", "col": 6, "id": 13, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 12}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 12}], "card_id": 12, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.705264Z", "sizeY": 4, "row": 18}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "day-of-week", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "day-of-week"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 6, "nil%": 0.0}, "type": {"type/Number": {"min": 6.0, "q1": 7.414213562373095, "q3": 11.757359312880714, "max": 38.0, "sd": 10.528871870107588, "avg": 12.5}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by day of the week", "query_average_duration": 195, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.483723Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "day-of-week"}]], "aggregation": [["count"]]}}, "id": 13, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:38.808186Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.850161Z", "col": 12, "id": 14, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 13}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 13}], "card_id": 13, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.850161Z", "sizeY": 4, "row": 18}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 10.25, "q3": 30.5, "max": 38.0, "sd": 12.62933094031509, "avg": 20.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "query_average_duration": 159, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.562877Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 14, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:38.938688Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:38.983764Z", "col": 0, "id": 15, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 14}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 14}], "card_id": 14, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:38.983764Z", "sizeY": 4, "row": 22}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "month-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "month-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.298221281347036, "q3": 27.5, "max": 38.0, "sd": 12.96148139681572, "avg": 20.0}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by month of the year", "query_average_duration": 119, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.52292Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "month-of-year"}]], "aggregation": [["count"]]}}, "id": 15, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:39.084258Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:39.132463Z", "col": 6, "id": 16, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 15}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 15}], "card_id": 15, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:39.132463Z", "sizeY": 4, "row": 22}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "most_recent_order", "field_ref": ["field", 42, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 42, "display_name": "most_recent_order", "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 8.0, "q1": 15.5, "q3": 50.0, "max": 54.0, "sd": 23.35237318418266, "avg": 33.333333333333336}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "query_average_duration": 73, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.567707Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 42, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 16, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["most_recent_order"], "graph.colors": ["#A6E7F3"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:39.228965Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:39.274309Z", "col": 12, "id": 17, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 16}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 16}], "card_id": 16, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:39.274309Z", "sizeY": 4, "row": 22}, {"sizeX": 6, "series": [], "collection_authority_level": null, "card": {"description": null, "archived": false, "collection_position": null, "table_id": 7, "result_metadata": [{"semantic_type": null, "coercion_strategy": null, "unit": "quarter-of-year", "name": "first_order", "field_ref": ["field", 39, {"temporal-unit": "quarter-of-year"}], "effective_type": "type/Date", "id": 39, "display_name": "first_order", "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "base_type": "type/Integer"}, {"name": "count", "display_name": "Count", "base_type": "type/BigInteger", "semantic_type": "type/Quantity", "field_ref": ["aggregation", 0], "fingerprint": {"global": {"distinct-count": 3, "nil%": 0.0}, "type": {"type/Number": {"min": 2.0, "q1": 11.0, "q3": 54.5, "max": 60.0, "sd": 29.280255007997, "avg": 33.333333333333336}}}}], "database_id": 2, "enable_embedding": false, "collection_id": 3, "query_type": "query", "name": "Timestamp by quarter of the year", "query_average_duration": 74, "creator_id": 1, "updated_at": "2021-07-21T08:01:42.603496Z", "made_public_by_id": null, "embedding_params": null, "cache_ttl": null, "dataset_query": {"type": "query", "database": 2, "query": {"source-table": 7, "breakout": [["field", 39, {"temporal-unit": "quarter-of-year"}]], "aggregation": [["count"]]}}, "id": 17, "display": "bar", "visualization_settings": {"graph.series_labels": ["number"], "graph.metrics": ["count"], "graph.dimensions": ["first_order"], "graph.colors": ["#F1B556"], "graph.x_axis.title_text": "Timestamp"}, "created_at": "2021-07-21T08:01:39.371067Z", "public_uuid": null}, "updated_at": "2021-07-21T08:01:39.426126Z", "col": 0, "id": 18, "parameter_mappings": [{"parameter_id": "-1693594175", "target": ["dimension", ["field", 42, null]], "card_id": 17}, {"parameter_id": "381527929", "target": ["dimension", ["field", 39, null]], "card_id": 17}], "card_id": 17, "visualization_settings": {}, "dashboard_id": 1, "created_at": "2021-07-21T08:01:39.426126Z", "sizeY": 4, "row": 26}], "param_values": null, "can_write": true, "enable_embedding": false, "collection_id": 3, "show_in_getting_started": false, "name": "A look at your customers table", "caveats": null, "collection_authority_level": null, "creator_id": 1, "updated_at": "2021-07-21T08:01:37.328519Z", "made_public_by_id": null, "embedding_params": null, "id": 1, "position": null, "param_fields": {"42": {"id": 42, "table_id": 7, "display_name": "most_recent_order", "base_type": "type/Date", "semantic_type": null, "has_field_values": "none", "name_field": null, "dimensions": []}, "39": {"id": 39, "table_id": 7, "display_name": "first_order", "base_type": "type/Date", "semantic_type": null, "has_field_values": "none", "name_field": null, "dimensions": []}}, "last-edit-info": {"id": 1, "email": "user@example.com", "first_name": "dbtmetabase", "last_name": "", "timestamp": "2021-07-21T08:01:39.542335Z"}, "parameters": [{"id": "-1693594175", "type": "date/all-options", "name": "most_recent_order", "slug": "most_recent_order"}, {"id": "381527929", "type": "date/all-options", "name": "first_order", "slug": "first_order"}], "created_at": "2021-07-21T08:01:37.328519Z", "public_uuid": null, "points_of_interest": null} diff --git a/tests/fixtures/mock_api/api/database.json b/tests/fixtures/mock_api/api/database.json deleted file mode 100644 index 4baa81eb..00000000 --- a/tests/fixtures/mock_api/api/database.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "native_permissions": "write", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}] \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/database/2/metadata.json b/tests/fixtures/mock_api/api/database/2/metadata.json deleted file mode 100644 index 9d3ebb59..00000000 --- a/tests/fixtures/mock_api/api/database/2/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "tables": [{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "show_in_getting_started": false, "name": "customers", "fields": [{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.194597Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 38, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "customer_id", "database_position": 0, "fingerprint": {"global": {"distinct-count": 100, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.5, "q3": 75.5, "max": 100.0, "sd": 29.008358252146028, "avg": 50.5}}}, "created_at": "2021-07-21T05:47:53.408064Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 7, "coercion_strategy": null, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.242305Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 37, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "first_name", "database_position": 1, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.404944Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 7, "coercion_strategy": null, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.249828Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 43, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "last_name", "database_position": 2, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.419931Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "date", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "name": "first_order", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.232032Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 39, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "first_order", "database_position": 3, "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "created_at": "2021-07-21T05:47:53.410556Z", "base_type": "type/Date", "points_of_interest": null}, {"description": null, "database_type": "date", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "name": "most_recent_order", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.186143Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 42, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 4, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "most_recent_order", "database_position": 4, "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.417127Z", "base_type": "type/Date", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": "type/Quantity", "table_id": 7, "coercion_strategy": null, "name": "number_of_orders", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.197576Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 40, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 5, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "number_of_orders", "database_position": 5, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.0901356485315583, "max": 5.0, "sd": 0.7779687173818424, "avg": 1.596774193548387}}}, "created_at": "2021-07-21T05:47:53.412376Z", "base_type": "type/BigInteger", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "name": "customer_lifetime_value", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.288463Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 41, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 6, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "customer_lifetime_value", "database_position": 6, "fingerprint": {"global": {"distinct-count": 36, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 13.464101615137753, "q3": 35.46410161513776, "max": 99.0, "sd": 18.812245525263663, "avg": 26.967741935483872}}}, "created_at": "2021-07-21T05:47:53.414671Z", "base_type": "type/BigInteger", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "metrics": [], "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "show_in_getting_started": false, "name": "orders", "fields": [{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.255223Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 47, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_id", "database_position": 0, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.25, "q3": 74.75, "max": 99.0, "sd": 28.719704534890823, "avg": 50.0}}}, "created_at": "2021-07-21T05:47:53.444318Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.259928Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 51, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "customer_id", "database_position": 1, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.452739Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "date", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.188819Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 46, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_date", "database_position": 2, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.441254Z", "base_type": "type/Date", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.203655Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 50, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "status", "database_position": 3, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.450839Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "name": "credit_card_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.24496Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 44, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 4, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "credit_card_amount", "database_position": 4, "fingerprint": {"global": {"distinct-count": 25, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 18.797054997187544, "max": 30.0, "sd": 10.959088854927673, "avg": 8.797979797979798}}}, "created_at": "2021-07-21T05:47:53.43752Z", "base_type": "type/BigInteger", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "name": "coupon_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.25752Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 49, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 5, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "coupon_amount", "database_position": 5, "fingerprint": {"global": {"distinct-count": 12, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.4747603274810728, "max": 26.0, "sd": 5.955012405351229, "avg": 1.8686868686868687}}}, "created_at": "2021-07-21T05:47:53.448941Z", "base_type": "type/BigInteger", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "name": "bank_transfer_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.25288Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 45, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 6, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "bank_transfer_amount", "database_position": 6, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 4.75, "max": 26.0, "sd": 7.420825132023675, "avg": 4.151515151515151}}}, "created_at": "2021-07-21T05:47:53.43953Z", "base_type": "type/BigInteger", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "name": "gift_card_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.201036Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 48, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 7, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "gift_card_amount", "database_position": 7, "fingerprint": {"global": {"distinct-count": 11, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 1.3692088763283736, "max": 30.0, "sd": 6.392362351566517, "avg": 2.0707070707070705}}}, "created_at": "2021-07-21T05:47:53.447026Z", "base_type": "type/BigInteger", "points_of_interest": null}, {"description": null, "database_type": "int8", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.206083Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 52, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 8, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "amount", "database_position": 8, "fingerprint": {"global": {"distinct-count": 32, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 8.202945002812456, "q3": 24.26138721247417, "max": 58.0, "sd": 10.736062525374601, "avg": 16.88888888888889}}}, "created_at": "2021-07-21T05:47:53.455652Z", "base_type": "type/BigInteger", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "metrics": [], "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "show_in_getting_started": false, "name": "raw_customers", "fields": [{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 9, "coercion_strategy": null, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.234376Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 55, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "id", "database_position": 0, "fingerprint": null, "created_at": "2021-07-21T05:47:53.473642Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 9, "coercion_strategy": null, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.208554Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 53, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "first_name", "database_position": 1, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.469932Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 9, "coercion_strategy": null, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.262668Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 54, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "last_name", "database_position": 2, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.471892Z", "base_type": "type/Text", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.166218Z", "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "metrics": [], "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "show_in_getting_started": false, "name": "raw_orders", "fields": [{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 12, "coercion_strategy": null, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.266036Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 57, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "id", "database_position": 0, "fingerprint": null, "created_at": "2021-07-21T05:47:53.48931Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": null, "table_id": 12, "coercion_strategy": null, "name": "user_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.214697Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 59, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "user_id", "database_position": 1, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.494231Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "date", "semantic_type": null, "table_id": 12, "coercion_strategy": null, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.268564Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 56, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_date", "database_position": 2, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.48571Z", "base_type": "type/Date", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 12, "coercion_strategy": null, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.211374Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 58, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "status", "database_position": 3, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.491699Z", "base_type": "type/Text", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "metrics": [], "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "show_in_getting_started": false, "name": "raw_payments", "fields": [{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 11, "coercion_strategy": null, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.271155Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 62, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "id", "database_position": 0, "fingerprint": null, "created_at": "2021-07-21T05:47:53.511724Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": null, "table_id": 11, "coercion_strategy": null, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.247411Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 60, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_id", "database_position": 1, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 24.904857366030992, "q3": 75.25, "max": 99.0, "sd": 28.540193317267853, "avg": 50.0353982300885}}}, "created_at": "2021-07-21T05:47:53.506967Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 11, "coercion_strategy": null, "name": "payment_method", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.217422Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 61, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "payment_method", "database_position": 2, "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 10.79646017699115}}}, "created_at": "2021-07-21T05:47:53.508887Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": "type/Category", "table_id": 11, "coercion_strategy": null, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.273607Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 63, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "amount", "database_position": 3, "fingerprint": {"global": {"distinct-count": 30, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 606.4037815689348, "q3": 2278.791845139511, "max": 3000.0, "sd": 919.836873351873, "avg": 1479.646017699115}}}, "created_at": "2021-07-21T05:47:53.513727Z", "base_type": "type/Integer", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "metrics": [], "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "show_in_getting_started": false, "name": "stg_customers", "fields": [{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 8, "coercion_strategy": null, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.276108Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 65, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "customer_id", "database_position": 0, "fingerprint": {"global": {"distinct-count": 100, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.5, "q3": 75.5, "max": 100.0, "sd": 29.008358252146028, "avg": 50.5}}}, "created_at": "2021-07-21T05:47:53.528091Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 8, "coercion_strategy": null, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.220226Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 64, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "first_name", "database_position": 1, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.525589Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 8, "coercion_strategy": null, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.222931Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 66, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "last_name", "database_position": 2, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.530075Z", "base_type": "type/Text", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.176617Z", "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "metrics": [], "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "show_in_getting_started": false, "name": "stg_orders", "fields": [{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.225874Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 68, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_id", "database_position": 0, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.25, "q3": 74.75, "max": 99.0, "sd": 28.719704534890823, "avg": 50.0}}}, "created_at": "2021-07-21T05:47:53.545842Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.229545Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 70, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "customer_id", "database_position": 1, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.549796Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "date", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.285732Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 67, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_date", "database_position": 2, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.543598Z", "base_type": "type/Date", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 5, "coercion_strategy": null, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.27984Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 69, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "status", "database_position": 3, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.547849Z", "base_type": "type/Text", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "metrics": [], "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "show_in_getting_started": false, "name": "stg_payments", "fields": [{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 10, "coercion_strategy": null, "name": "payment_id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.191434Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 74, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "payment_id", "database_position": 0, "fingerprint": {"global": {"distinct-count": 113, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 28.75, "q3": 85.25, "max": 113.0, "sd": 32.76097144469315, "avg": 57.0}}}, "created_at": "2021-07-21T05:47:53.570339Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": null, "table_id": 10, "coercion_strategy": null, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.282867Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 71, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "order_id", "database_position": 1, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 24.904857366030992, "q3": 75.25, "max": 99.0, "sd": 28.540193317267853, "avg": 50.0353982300885}}}, "created_at": "2021-07-21T05:47:53.562985Z", "base_type": "type/Integer", "points_of_interest": null}, {"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 10, "coercion_strategy": null, "name": "payment_method", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.236542Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 72, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "payment_method", "database_position": 2, "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 10.79646017699115}}}, "created_at": "2021-07-21T05:47:53.566146Z", "base_type": "type/Text", "points_of_interest": null}, {"description": null, "database_type": "int4", "semantic_type": "type/Category", "table_id": 10, "coercion_strategy": null, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "updated_at": "2021-07-21T07:30:35.240154Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 73, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "target": null, "preview_display": true, "display_name": "amount", "database_position": 3, "fingerprint": {"global": {"distinct-count": 30, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 6.064037815689349, "q3": 22.787918451395115, "max": 30.0, "sd": 9.198368733518729, "avg": 14.79646017699115}}}, "created_at": "2021-07-21T05:47:53.568245Z", "base_type": "type/Integer", "points_of_interest": null}], "caveats": null, "segments": [], "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "metrics": [], "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}], "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/37.json b/tests/fixtures/mock_api/api/field/37.json deleted file mode 100644 index e3101160..00000000 --- a/tests/fixtures/mock_api/api/field/37.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.242305Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 37, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "first_name", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.404944Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/38.json b/tests/fixtures/mock_api/api/field/38.json deleted file mode 100644 index b923530f..00000000 --- a/tests/fixtures/mock_api/api/field/38.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.194597Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 38, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "customer_id", "database_position": 0, "name_field": null, "fingerprint": {"global": {"distinct-count": 100, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.5, "q3": 75.5, "max": 100.0, "sd": 29.008358252146028, "avg": 50.5}}}, "created_at": "2021-07-21T05:47:53.408064Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/39.json b/tests/fixtures/mock_api/api/field/39.json deleted file mode 100644 index 9e6696f4..00000000 --- a/tests/fixtures/mock_api/api/field/39.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "date", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "first_order", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.232032Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 39, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "first_order", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 47, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-07"}}}, "created_at": "2021-07-21T05:47:53.410556Z", "base_type": "type/Date", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/40.json b/tests/fixtures/mock_api/api/field/40.json deleted file mode 100644 index fec9761d..00000000 --- a/tests/fixtures/mock_api/api/field/40.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": "type/Quantity", "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "number_of_orders", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.197576Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 40, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 5, "visibility_type": "normal", "preview_display": true, "display_name": "number_of_orders", "database_position": 5, "name_field": null, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 1.0, "q3": 2.0901356485315583, "max": 5.0, "sd": 0.7779687173818424, "avg": 1.596774193548387}}}, "created_at": "2021-07-21T05:47:53.412376Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/41.json b/tests/fixtures/mock_api/api/field/41.json deleted file mode 100644 index 4758b3be..00000000 --- a/tests/fixtures/mock_api/api/field/41.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "customer_lifetime_value", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.288463Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 41, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 6, "visibility_type": "normal", "preview_display": true, "display_name": "customer_lifetime_value", "database_position": 6, "name_field": null, "fingerprint": {"global": {"distinct-count": 36, "nil%": 0.38}, "type": {"type/Number": {"min": 1.0, "q1": 13.464101615137753, "q3": 35.46410161513776, "max": 99.0, "sd": 18.812245525263663, "avg": 26.967741935483872}}}, "created_at": "2021-07-21T05:47:53.414671Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/42.json b/tests/fixtures/mock_api/api/field/42.json deleted file mode 100644 index cc6e68a0..00000000 --- a/tests/fixtures/mock_api/api/field/42.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "date", "semantic_type": null, "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "most_recent_order", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.186143Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 42, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 4, "visibility_type": "normal", "preview_display": true, "display_name": "most_recent_order", "database_position": 4, "name_field": null, "fingerprint": {"global": {"distinct-count": 53, "nil%": 0.38}, "type": {"type/DateTime": {"earliest": "2018-01-09", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.417127Z", "base_type": "type/Date", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/43.json b/tests/fixtures/mock_api/api/field/43.json deleted file mode 100644 index 3884315f..00000000 --- a/tests/fixtures/mock_api/api/field/43.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 7, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.249828Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 43, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "last_name", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.419931Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/44.json b/tests/fixtures/mock_api/api/field/44.json deleted file mode 100644 index dea1cf40..00000000 --- a/tests/fixtures/mock_api/api/field/44.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "credit_card_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.24496Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 44, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 4, "visibility_type": "normal", "preview_display": true, "display_name": "credit_card_amount", "database_position": 4, "name_field": null, "fingerprint": {"global": {"distinct-count": 25, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 18.797054997187544, "max": 30.0, "sd": 10.959088854927673, "avg": 8.797979797979798}}}, "created_at": "2021-07-21T05:47:53.43752Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/45.json b/tests/fixtures/mock_api/api/field/45.json deleted file mode 100644 index 788e888b..00000000 --- a/tests/fixtures/mock_api/api/field/45.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "bank_transfer_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.25288Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 45, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 6, "visibility_type": "normal", "preview_display": true, "display_name": "bank_transfer_amount", "database_position": 6, "name_field": null, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 4.75, "max": 26.0, "sd": 7.420825132023675, "avg": 4.151515151515151}}}, "created_at": "2021-07-21T05:47:53.43953Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/46.json b/tests/fixtures/mock_api/api/field/46.json deleted file mode 100644 index 389e2add..00000000 --- a/tests/fixtures/mock_api/api/field/46.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "date", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.188819Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 46, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "order_date", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.441254Z", "base_type": "type/Date", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/47.json b/tests/fixtures/mock_api/api/field/47.json deleted file mode 100644 index 2a299503..00000000 --- a/tests/fixtures/mock_api/api/field/47.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.255223Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 47, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "order_id", "database_position": 0, "name_field": null, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.25, "q3": 74.75, "max": 99.0, "sd": 28.719704534890823, "avg": 50.0}}}, "created_at": "2021-07-21T05:47:53.444318Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/48.json b/tests/fixtures/mock_api/api/field/48.json deleted file mode 100644 index 416cb934..00000000 --- a/tests/fixtures/mock_api/api/field/48.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "gift_card_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.201036Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 48, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 7, "visibility_type": "normal", "preview_display": true, "display_name": "gift_card_amount", "database_position": 7, "name_field": null, "fingerprint": {"global": {"distinct-count": 11, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 1.3692088763283736, "max": 30.0, "sd": 6.392362351566517, "avg": 2.0707070707070705}}}, "created_at": "2021-07-21T05:47:53.447026Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/49.json b/tests/fixtures/mock_api/api/field/49.json deleted file mode 100644 index 9317c69c..00000000 --- a/tests/fixtures/mock_api/api/field/49.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "coupon_amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.25752Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 49, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 5, "visibility_type": "normal", "preview_display": true, "display_name": "coupon_amount", "database_position": 5, "name_field": null, "fingerprint": {"global": {"distinct-count": 12, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 0.0, "q3": 0.4747603274810728, "max": 26.0, "sd": 5.955012405351229, "avg": 1.8686868686868687}}}, "created_at": "2021-07-21T05:47:53.448941Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/50.json b/tests/fixtures/mock_api/api/field/50.json deleted file mode 100644 index 6f0fcab8..00000000 --- a/tests/fixtures/mock_api/api/field/50.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.203655Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 50, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "status", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.450839Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/51.json b/tests/fixtures/mock_api/api/field/51.json deleted file mode 100644 index 64b8a6a5..00000000 --- a/tests/fixtures/mock_api/api/field/51.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.259928Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 51, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "customer_id", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.452739Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/52.json b/tests/fixtures/mock_api/api/field/52.json deleted file mode 100644 index 1a0c405b..00000000 --- a/tests/fixtures/mock_api/api/field/52.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int8", "semantic_type": null, "table_id": 6, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.206083Z", "custom_position": 0, "effective_type": "type/BigInteger", "active": true, "parent_id": null, "id": 52, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 8, "visibility_type": "normal", "preview_display": true, "display_name": "amount", "database_position": 8, "name_field": null, "fingerprint": {"global": {"distinct-count": 32, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 8.202945002812456, "q3": 24.26138721247417, "max": 58.0, "sd": 10.736062525374601, "avg": 16.88888888888889}}}, "created_at": "2021-07-21T05:47:53.455652Z", "base_type": "type/BigInteger", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/53.json b/tests/fixtures/mock_api/api/field/53.json deleted file mode 100644 index dd731d37..00000000 --- a/tests/fixtures/mock_api/api/field/53.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 9, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.166218Z", "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null}, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.208554Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 53, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "first_name", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.469932Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/54.json b/tests/fixtures/mock_api/api/field/54.json deleted file mode 100644 index 760b9bbc..00000000 --- a/tests/fixtures/mock_api/api/field/54.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 9, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.166218Z", "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null}, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.262668Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 54, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "last_name", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.471892Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/55.json b/tests/fixtures/mock_api/api/field/55.json deleted file mode 100644 index 4f99af38..00000000 --- a/tests/fixtures/mock_api/api/field/55.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 9, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.166218Z", "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null}, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.234376Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 55, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "id", "database_position": 0, "name_field": {"id": 54, "table_id": 9, "display_name": "last_name", "base_type": "type/Text", "semantic_type": "type/Name", "has_field_values": "list"}, "fingerprint": null, "created_at": "2021-07-21T05:47:53.473642Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/56.json b/tests/fixtures/mock_api/api/field/56.json deleted file mode 100644 index 5b272ebc..00000000 --- a/tests/fixtures/mock_api/api/field/56.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "date", "semantic_type": null, "table_id": 12, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.268564Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 56, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "order_date", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.48571Z", "base_type": "type/Date", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/57.json b/tests/fixtures/mock_api/api/field/57.json deleted file mode 100644 index f6922499..00000000 --- a/tests/fixtures/mock_api/api/field/57.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 12, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.266036Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 57, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "id", "database_position": 0, "name_field": null, "fingerprint": null, "created_at": "2021-07-21T05:47:53.48931Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/58.json b/tests/fixtures/mock_api/api/field/58.json deleted file mode 100644 index 0b66f0d9..00000000 --- a/tests/fixtures/mock_api/api/field/58.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 12, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.211374Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 58, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "status", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.491699Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/59.json b/tests/fixtures/mock_api/api/field/59.json deleted file mode 100644 index d1210c85..00000000 --- a/tests/fixtures/mock_api/api/field/59.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 12, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, "name": "user_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.214697Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 59, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "user_id", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.494231Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/60.json b/tests/fixtures/mock_api/api/field/60.json deleted file mode 100644 index 6a97690d..00000000 --- a/tests/fixtures/mock_api/api/field/60.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 11, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.247411Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 60, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "order_id", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 24.904857366030992, "q3": 75.25, "max": 99.0, "sd": 28.540193317267853, "avg": 50.0353982300885}}}, "created_at": "2021-07-21T05:47:53.506967Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/61.json b/tests/fixtures/mock_api/api/field/61.json deleted file mode 100644 index 598ced77..00000000 --- a/tests/fixtures/mock_api/api/field/61.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 11, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, "name": "payment_method", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.217422Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 61, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "payment_method", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 10.79646017699115}}}, "created_at": "2021-07-21T05:47:53.508887Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/62.json b/tests/fixtures/mock_api/api/field/62.json deleted file mode 100644 index 60430390..00000000 --- a/tests/fixtures/mock_api/api/field/62.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": "type/PK", "table_id": 11, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, "name": "id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.271155Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 62, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "id", "database_position": 0, "name_field": null, "fingerprint": null, "created_at": "2021-07-21T05:47:53.511724Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/63.json b/tests/fixtures/mock_api/api/field/63.json deleted file mode 100644 index aa9368c8..00000000 --- a/tests/fixtures/mock_api/api/field/63.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": "type/Category", "table_id": 11, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.273607Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 63, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "amount", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 30, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 606.4037815689348, "q3": 2278.791845139511, "max": 3000.0, "sd": 919.836873351873, "avg": 1479.646017699115}}}, "created_at": "2021-07-21T05:47:53.513727Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/64.json b/tests/fixtures/mock_api/api/field/64.json deleted file mode 100644 index a3205d6d..00000000 --- a/tests/fixtures/mock_api/api/field/64.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 8, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.176617Z", "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null}, "name": "first_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.220226Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 64, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "first_name", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 79, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.02, "average-length": 5.86}}}, "created_at": "2021-07-21T05:47:53.525589Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/65.json b/tests/fixtures/mock_api/api/field/65.json deleted file mode 100644 index 74ffa574..00000000 --- a/tests/fixtures/mock_api/api/field/65.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 8, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.176617Z", "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null}, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.276108Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 65, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "customer_id", "database_position": 0, "name_field": null, "fingerprint": {"global": {"distinct-count": 100, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.5, "q3": 75.5, "max": 100.0, "sd": 29.008358252146028, "avg": 50.5}}}, "created_at": "2021-07-21T05:47:53.528091Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/66.json b/tests/fixtures/mock_api/api/field/66.json deleted file mode 100644 index 8ba8e9b2..00000000 --- a/tests/fixtures/mock_api/api/field/66.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Name", "table_id": 8, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.176617Z", "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null}, "name": "last_name", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.222931Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 66, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "last_name", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 19, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 2.0}}}, "created_at": "2021-07-21T05:47:53.530075Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/67.json b/tests/fixtures/mock_api/api/field/67.json deleted file mode 100644 index 3a0b8055..00000000 --- a/tests/fixtures/mock_api/api/field/67.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "date", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, "name": "order_date", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.285732Z", "custom_position": 0, "effective_type": "type/Date", "active": true, "parent_id": null, "id": 67, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "order_date", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 69, "nil%": 0.0}, "type": {"type/DateTime": {"earliest": "2018-01-01", "latest": "2018-04-09"}}}, "created_at": "2021-07-21T05:47:53.543598Z", "base_type": "type/Date", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/68.json b/tests/fixtures/mock_api/api/field/68.json deleted file mode 100644 index 15a23b72..00000000 --- a/tests/fixtures/mock_api/api/field/68.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.225874Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 68, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "order_id", "database_position": 0, "name_field": null, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.25, "q3": 74.75, "max": 99.0, "sd": 28.719704534890823, "avg": 50.0}}}, "created_at": "2021-07-21T05:47:53.545842Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/69.json b/tests/fixtures/mock_api/api/field/69.json deleted file mode 100644 index fff0018d..00000000 --- a/tests/fixtures/mock_api/api/field/69.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 5, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, "name": "status", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.27984Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 69, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "status", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 5, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 8.404040404040405}}}, "created_at": "2021-07-21T05:47:53.547849Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/70.json b/tests/fixtures/mock_api/api/field/70.json deleted file mode 100644 index 973a6828..00000000 --- a/tests/fixtures/mock_api/api/field/70.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 5, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, "name": "customer_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.229545Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 70, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "customer_id", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 62, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 25.875, "q3": 69.625, "max": 99.0, "sd": 27.781341350472964, "avg": 48.25252525252525}}}, "created_at": "2021-07-21T05:47:53.549796Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/71.json b/tests/fixtures/mock_api/api/field/71.json deleted file mode 100644 index 7aefc81b..00000000 --- a/tests/fixtures/mock_api/api/field/71.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 10, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}, "name": "order_id", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.282867Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 71, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 1, "visibility_type": "normal", "preview_display": true, "display_name": "order_id", "database_position": 1, "name_field": null, "fingerprint": {"global": {"distinct-count": 99, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 24.904857366030992, "q3": 75.25, "max": 99.0, "sd": 28.540193317267853, "avg": 50.0353982300885}}}, "created_at": "2021-07-21T05:47:53.562985Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/72.json b/tests/fixtures/mock_api/api/field/72.json deleted file mode 100644 index ae48933f..00000000 --- a/tests/fixtures/mock_api/api/field/72.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "text", "semantic_type": "type/Category", "table_id": 10, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}, "name": "payment_method", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.236542Z", "custom_position": 0, "effective_type": "type/Text", "active": true, "parent_id": null, "id": 72, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 2, "visibility_type": "normal", "preview_display": true, "display_name": "payment_method", "database_position": 2, "name_field": null, "fingerprint": {"global": {"distinct-count": 4, "nil%": 0.0}, "type": {"type/Text": {"percent-json": 0.0, "percent-url": 0.0, "percent-email": 0.0, "percent-state": 0.0, "average-length": 10.79646017699115}}}, "created_at": "2021-07-21T05:47:53.566146Z", "base_type": "type/Text", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/73.json b/tests/fixtures/mock_api/api/field/73.json deleted file mode 100644 index 74b63c73..00000000 --- a/tests/fixtures/mock_api/api/field/73.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": "type/Category", "table_id": 10, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}, "name": "amount", "fingerprint_version": 5, "has_field_values": "list", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.240154Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 73, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 3, "visibility_type": "normal", "preview_display": true, "display_name": "amount", "database_position": 3, "name_field": null, "fingerprint": {"global": {"distinct-count": 30, "nil%": 0.0}, "type": {"type/Number": {"min": 0.0, "q1": 6.064037815689349, "q3": 22.787918451395115, "max": 30.0, "sd": 9.198368733518729, "avg": 14.79646017699115}}}, "created_at": "2021-07-21T05:47:53.568245Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/field/74.json b/tests/fixtures/mock_api/api/field/74.json deleted file mode 100644 index 0c465b0a..00000000 --- a/tests/fixtures/mock_api/api/field/74.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "database_type": "int4", "semantic_type": null, "table_id": 10, "coercion_strategy": null, "table": {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}, "name": "payment_id", "fingerprint_version": 5, "has_field_values": "none", "settings": null, "caveats": null, "fk_target_field_id": null, "dimensions": [], "updated_at": "2021-07-21T07:30:35.191434Z", "custom_position": 0, "effective_type": "type/Integer", "active": true, "parent_id": null, "id": 74, "last_analyzed": "2021-07-21T05:47:54.560768Z", "position": 0, "visibility_type": "normal", "preview_display": true, "display_name": "payment_id", "database_position": 0, "name_field": null, "fingerprint": {"global": {"distinct-count": 113, "nil%": 0.0}, "type": {"type/Number": {"min": 1.0, "q1": 28.75, "q3": 85.25, "max": 113.0, "sd": 32.76097144469315, "avg": 57.0}}}, "created_at": "2021-07-21T05:47:53.570339Z", "base_type": "type/Integer", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table.json b/tests/fixtures/mock_api/api/table.json deleted file mode 100644 index 9c0ddda0..00000000 --- a/tests/fixtures/mock_api/api/table.json +++ /dev/null @@ -1 +0,0 @@ -[{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.166218Z", "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.176617Z", "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null}, {"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null}] \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/10.json b/tests/fixtures/mock_api/api/table/10.json deleted file mode 100644 index 2ec3099a..00000000 --- a/tests/fixtures/mock_api/api/table/10.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.181929Z", "pk_field": null, "entity_name": null, "active": true, "id": 10, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_payments", "created_at": "2021-07-21T05:47:53.384404Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/11.json b/tests/fixtures/mock_api/api/table/11.json deleted file mode 100644 index 0120e52d..00000000 --- a/tests/fixtures/mock_api/api/table/11.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_payments", "caveats": null, "updated_at": "2021-07-21T07:30:35.173953Z", "pk_field": 62, "entity_name": null, "active": true, "id": 11, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_payments", "created_at": "2021-07-21T05:47:53.388179Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/12.json b/tests/fixtures/mock_api/api/table/12.json deleted file mode 100644 index cbb3775d..00000000 --- a/tests/fixtures/mock_api/api/table/12.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.170459Z", "pk_field": 57, "entity_name": null, "active": true, "id": 12, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_orders", "created_at": "2021-07-21T05:47:53.391873Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/5.json b/tests/fixtures/mock_api/api/table/5.json deleted file mode 100644 index 386cf19f..00000000 --- a/tests/fixtures/mock_api/api/table/5.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.179323Z", "pk_field": null, "entity_name": null, "active": true, "id": 5, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_orders", "created_at": "2021-07-21T05:47:53.363321Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/6.json b/tests/fixtures/mock_api/api/table/6.json deleted file mode 100644 index b70b3439..00000000 --- a/tests/fixtures/mock_api/api/table/6.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/TransactionTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "orders", "caveats": null, "updated_at": "2021-07-21T07:30:35.162732Z", "pk_field": null, "entity_name": null, "active": true, "id": 6, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "orders", "created_at": "2021-07-21T05:47:53.368244Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/7.json b/tests/fixtures/mock_api/api/table/7.json deleted file mode 100644 index 39c7f24d..00000000 --- a/tests/fixtures/mock_api/api/table/7.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.159586Z", "pk_field": null, "entity_name": null, "active": true, "id": 7, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "customers", "created_at": "2021-07-21T05:47:53.372467Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/8.json b/tests/fixtures/mock_api/api/table/8.json deleted file mode 100644 index 53e6d182..00000000 --- a/tests/fixtures/mock_api/api/table/8.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "stg_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.176617Z", "pk_field": null, "entity_name": null, "active": true, "id": 8, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "stg_customers", "created_at": "2021-07-21T05:47:53.376525Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/table/9.json b/tests/fixtures/mock_api/api/table/9.json deleted file mode 100644 index a2eda040..00000000 --- a/tests/fixtures/mock_api/api/table/9.json +++ /dev/null @@ -1 +0,0 @@ -{"description": null, "entity_type": "entity/GenericTable", "schema": "public", "db": {"description": null, "features": ["full-join", "basic-aggregations", "standard-deviation-aggregations", "expression-aggregations", "percentile-aggregations", "foreign-keys", "right-join", "left-join", "native-parameters", "nested-queries", "expressions", "set-timezone", "regex", "case-sensitivity-string-filter-options", "binning", "inner-join", "advanced-math-expressions"], "cache_field_values_schedule": "0 0 22 * * ? *", "timezone": "UTC", "auto_run_queries": true, "metadata_sync_schedule": "0 46 * * * ? *", "name": "unit_testing", "caveats": null, "is_full_sync": true, "updated_at": "2021-07-21T07:05:13.699978Z", "details": {"host": "postgres", "port": null, "dbname": "test", "user": "postgres", "password": "**MetabasePass**", "ssl": false, "additional-options": null, "tunnel-enabled": false}, "is_sample": false, "id": 2, "is_on_demand": false, "options": null, "engine": "postgres", "refingerprint": null, "created_at": "2021-07-21T05:38:53.637091Z", "points_of_interest": null}, "show_in_getting_started": false, "name": "raw_customers", "caveats": null, "updated_at": "2021-07-21T07:30:35.166218Z", "pk_field": 55, "entity_name": null, "active": true, "id": 9, "db_id": 2, "visibility_type": null, "field_order": "database", "display_name": "raw_customers", "created_at": "2021-07-21T05:47:53.380782Z", "points_of_interest": null} \ No newline at end of file diff --git a/tests/fixtures/mock_api/api/user.json b/tests/fixtures/mock_api/api/user.json deleted file mode 100644 index 0b426cd4..00000000 --- a/tests/fixtures/mock_api/api/user.json +++ /dev/null @@ -1 +0,0 @@ -[{"email": "user@example.com", "ldap_auth": false, "first_name": "dbtmetabase", "locale": null, "last_login": "2021-07-21T19:25:28.6083Z", "is_active": true, "is_qbnewb": false, "updated_at": "2021-07-21T19:25:28.6083", "group_ids": [1, 2], "is_superuser": true, "login_attributes": null, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "personal_collection_id": 1, "common_name": "dbtmetabase", "google_auth": false}] diff --git a/tests/fixtures/mock_api/api/user/1.json b/tests/fixtures/mock_api/api/user/1.json deleted file mode 100644 index b0aa0c1f..00000000 --- a/tests/fixtures/mock_api/api/user/1.json +++ /dev/null @@ -1 +0,0 @@ -{"email": "user@example.com", "ldap_auth": false, "first_name": "dbtmetabase", "locale": null, "last_login": "2021-07-21T19:25:28.6083Z", "is_active": true, "is_qbnewb": false, "updated_at": "2021-07-21T19:25:28.6083", "group_ids": [1, 2], "is_superuser": true, "login_attributes": null, "id": 1, "last_name": "", "date_joined": "2021-07-21T05:38:53.637091Z", "common_name": "dbtmetabase", "google_auth": false} diff --git a/tests/test_core_exposures.py b/tests/test_core_exposures.py new file mode 100644 index 00000000..147742dc --- /dev/null +++ b/tests/test_core_exposures.py @@ -0,0 +1,76 @@ +# pylint: disable=protected-access,no-member + +import unittest +from operator import itemgetter +from pathlib import Path + +import yaml + +from ._mocks import FIXTURES_PATH, TMP_PATH, MockCore + + +class TestExposures(unittest.TestCase): + def setUp(self): + TMP_PATH.mkdir(exist_ok=True) + self.core = MockCore() + + def _assert_exposures(self, expected_path: Path, actual_path: Path): + with open(expected_path, encoding="utf-8") as f: + expected = yaml.safe_load(f) + with open(actual_path, encoding="utf-8") as f: + actual = yaml.safe_load(f) + + self.assertEqual( + sorted(expected["exposures"], key=itemgetter("name")), + actual["exposures"], + ) + + def test_exposures(self): + fixtures_path = FIXTURES_PATH / "exposure" / "default" + output_path = TMP_PATH / "exposure" / "default" + self.core.extract_exposures( + output_path=str(output_path), + output_grouping=None, + ) + + self._assert_exposures( + fixtures_path / "exposures.yml", + output_path / "exposures.yml", + ) + + def test_exposures_collection_grouping(self): + fixtures_path = FIXTURES_PATH / "exposure" / "collection" + output_path = TMP_PATH / "exposure" / "collection" + self.core.extract_exposures( + output_path=str(output_path), + output_grouping="collection", + ) + + self._assert_exposures( + fixtures_path / "a_look_at_your_customers_table.yml", + output_path / "a_look_at_your_customers_table.yml", + ) + self._assert_exposures( + fixtures_path / "our_analytics.yml", + output_path / "our_analytics.yml", + ) + + def test_exposures_grouping_type(self): + fixtures_path = FIXTURES_PATH / "exposure" / "type" + output_path = TMP_PATH / "exposure" / "type" + self.core.extract_exposures( + output_path=str(output_path), + output_grouping="type", + ) + + for i in range(1, 18): + self._assert_exposures( + fixtures_path / "card" / f"{i}.yml", + output_path / "card" / f"{i}.yml", + ) + + for i in range(1, 2): + self._assert_exposures( + fixtures_path / "dashboard" / f"{i}.yml", + output_path / "dashboard" / f"{i}.yml", + ) diff --git a/tests/test_core_models.py b/tests/test_core_models.py new file mode 100644 index 00000000..a604b75a --- /dev/null +++ b/tests/test_core_models.py @@ -0,0 +1,63 @@ +# pylint: disable=protected-access,no-member + +import unittest + +from ._mocks import MockCore + + +class TestModels(unittest.TestCase): + def setUp(self): + self.core = MockCore() + self.core._ModelsExporterMixin__SYNC_PERIOD = 1 # type: ignore + + def test_export(self): + self.core.export_models( + metabase_database="unit_testing", + skip_sources=True, + sync_timeout=0, + ) + + def test_build_lookups(self): + expected_tables = [ + "PUBLIC.CUSTOMERS", + "PUBLIC.ORDERS", + "PUBLIC.RAW_CUSTOMERS", + "PUBLIC.RAW_ORDERS", + "PUBLIC.RAW_PAYMENTS", + "PUBLIC.STG_CUSTOMERS", + "PUBLIC.STG_ORDERS", + "PUBLIC.STG_PAYMENTS", + ] + actual_tables = self.core._ModelsExporterMixin__get_tables(database_id="2") # type: ignore + self.assertEqual(expected_tables, list(actual_tables.keys())) + + expected_columns = [ + [ + "CUSTOMER_ID", + "FIRST_NAME", + "LAST_NAME", + "FIRST_ORDER", + "MOST_RECENT_ORDER", + "NUMBER_OF_ORDERS", + "CUSTOMER_LIFETIME_VALUE", + ], + [ + "ORDER_ID", + "CUSTOMER_ID", + "ORDER_DATE", + "STATUS", + "CREDIT_CARD_AMOUNT", + "COUPON_AMOUNT", + "BANK_TRANSFER_AMOUNT", + "GIFT_CARD_AMOUNT", + "AMOUNT", + ], + ["ID", "FIRST_NAME", "LAST_NAME"], + ["ID", "USER_ID", "ORDER_DATE", "STATUS"], + ["ID", "ORDER_ID", "PAYMENT_METHOD", "AMOUNT"], + ["CUSTOMER_ID", "FIRST_NAME", "LAST_NAME"], + ["ORDER_ID", "CUSTOMER_ID", "ORDER_DATE", "STATUS"], + ["PAYMENT_ID", "ORDER_ID", "PAYMENT_METHOD", "AMOUNT"], + ] + for table, columns in zip(expected_tables, expected_columns): + self.assertEqual(columns, list(actual_tables[table]["fields"].keys())) diff --git a/tests/test_dbt.py b/tests/test_dbt.py deleted file mode 100644 index 698c9763..00000000 --- a/tests/test_dbt.py +++ /dev/null @@ -1,269 +0,0 @@ -import logging -import unittest -from pathlib import Path - -from dbtmetabase.dbt import ( - DbtReader, - MetabaseColumn, - MetabaseModel, - ModelType, - NullValue, -) - - -class TestDbtReader(unittest.TestCase): - def setUp(self): - """Must specify dbt root dir""" - self.reader = DbtReader( - manifest_path=str(Path("tests") / "fixtures" / "dbt" / "manifest.json"), - database="test", - schema="public", - ) - logging.getLogger(__name__) - logging.basicConfig(level=logging.DEBUG) - - def test_read_models(self): - models = self.reader.read_models() - expectation = [ - MetabaseModel( - name="orders", - schema="PUBLIC", - description="This table has basic information about orders, as well as some derived facts based on payments", - model_type=ModelType.nodes, - source=None, - unique_id="model.jaffle_shop.orders", - columns=[ - MetabaseColumn( - name="ORDER_ID", - description="This is a unique identifier for an order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="CUSTOMER_ID", - description="Foreign key to the customers table", - meta_fields={}, - semantic_type="type/FK", - visibility_type=None, - fk_target_table="PUBLIC.CUSTOMERS", - fk_target_field="CUSTOMER_ID", - ), - MetabaseColumn( - name="ORDER_DATE", - description="Date (UTC) that the order was placed", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="STATUS", - description="Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="AMOUNT", - description="Total amount (AUD) of the order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="CREDIT_CARD_AMOUNT", - description="Amount of the order (AUD) paid for by credit card", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="COUPON_AMOUNT", - description="Amount of the order (AUD) paid for by coupon", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="BANK_TRANSFER_AMOUNT", - description="Amount of the order (AUD) paid for by bank transfer", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="GIFT_CARD_AMOUNT", - description="Amount of the order (AUD) paid for by gift card", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="customers", - schema="PUBLIC", - description="This table has basic information about a customer, as well as some derived facts based on a customer's orders", - model_type=ModelType.nodes, - source=None, - unique_id="model.jaffle_shop.customers", - columns=[ - MetabaseColumn( - name="CUSTOMER_ID", - description="This is a unique identifier for a customer", - meta_fields={}, - semantic_type=None, # This is a PK field, should not be detected as FK - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="FIRST_NAME", - description="Customer's first name. PII.", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="LAST_NAME", - description="Customer's last name. PII.", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="FIRST_ORDER", - description="Date (UTC) of a customer's first order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="MOST_RECENT_ORDER", - description="Date (UTC) of a customer's most recent order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="NUMBER_OF_ORDERS", - description="Count of the number of orders a customer has placed", - meta_fields={}, - semantic_type=NullValue, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="TOTAL_ORDER_AMOUNT", - description="Total value (AUD) of a customer's orders", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_orders", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - source=None, - unique_id="model.jaffle_shop.stg_orders", - columns=[ - MetabaseColumn( - name="ORDER_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="STATUS", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_payments", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - source=None, - unique_id="model.jaffle_shop.stg_payments", - columns=[ - MetabaseColumn( - name="PAYMENT_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="PAYMENT_METHOD", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_customers", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - source=None, - unique_id="model.jaffle_shop.stg_customers", - columns=[ - MetabaseColumn( - name="CUSTOMER_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ) - ], - ), - ] - self.assertEqual(models, expectation) - logging.info("Done") diff --git a/tests/test_manifest.py b/tests/test_manifest.py new file mode 100644 index 00000000..4ca11d76 --- /dev/null +++ b/tests/test_manifest.py @@ -0,0 +1,14 @@ +import unittest +from pathlib import Path + +from dbtmetabase.manifest import Manifest + +from ._mocks import MANIFEST_MODELS + + +class TestManifest(unittest.TestCase): + def setUp(self): + self.reader = Manifest(path=Path("tests") / "fixtures" / "manifest.json") + + def test_read_models(self): + self.assertEqual(MANIFEST_MODELS, self.reader.read_models()) diff --git a/tests/test_metabase.py b/tests/test_metabase.py deleted file mode 100644 index 45157955..00000000 --- a/tests/test_metabase.py +++ /dev/null @@ -1,402 +0,0 @@ -# pylint: disable=protected-access - -import json -import logging -import unittest -from operator import itemgetter -from pathlib import Path - -import yaml - -from dbtmetabase.dbt import MetabaseColumn, MetabaseModel, ModelType -from dbtmetabase.metabase import MetabaseClient, _ExportModelsJob, _ExtractExposuresJob - -FIXTURES_PATH = Path("tests") / "fixtures" -TMP_PATH = Path("tests") / "tmp" - -MODELS = [ - MetabaseModel( - name="orders", - schema="PUBLIC", - description="This table has basic information about orders, as well as some derived facts based on payments", - model_type=ModelType.nodes, - columns=[ - MetabaseColumn( - name="ORDER_ID", - description="This is a unique identifier for an order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="CUSTOMER_ID", - description="Foreign key to the customers table", - meta_fields={}, - semantic_type="type/FK", - visibility_type=None, - fk_target_table="PUBLIC.customers", - fk_target_field="CUSTOMER_ID", - ), - MetabaseColumn( - name="ORDER_DATE", - description="Date (UTC) that the order was placed", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="STATUS", - description="Orders can be one of the following statuses:\n\n| status | description |\n|----------------|------------------------------------------------------------------------------------------------------------------------|\n| placed | The order has been placed but has not yet left the warehouse |\n| shipped | The order has ben shipped to the customer and is currently in transit |\n| completed | The order has been received by the customer |\n| return_pending | The customer has indicated that they would like to return the order, but it has not yet been received at the warehouse |\n| returned | The order has been returned by the customer and received at the warehouse |", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="AMOUNT", - description="Total amount (AUD) of the order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="CREDIT_CARD_AMOUNT", - description="Amount of the order (AUD) paid for by credit card", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="COUPON_AMOUNT", - description="Amount of the order (AUD) paid for by coupon", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="BANK_TRANSFER_AMOUNT", - description="Amount of the order (AUD) paid for by bank transfer", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="GIFT_CARD_AMOUNT", - description="Amount of the order (AUD) paid for by gift card", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="customers", - schema="PUBLIC", - description="This table has basic information about a customer, as well as some derived facts based on a customer's orders", - model_type=ModelType.nodes, - columns=[ - MetabaseColumn( - name="CUSTOMER_ID", - description="This is a unique identifier for a customer", - meta_fields={}, - semantic_type="type/FK", - visibility_type=None, - fk_target_table="PUBLIC.orders", - fk_target_field="CUSTOMER_ID", - ), - MetabaseColumn( - name="FIRST_NAME", - description="Customer's first name. PII.", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="LAST_NAME", - description="Customer's last name. PII.", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="FIRST_ORDER", - description="Date (UTC) of a customer's first order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="MOST_RECENT_ORDER", - description="Date (UTC) of a customer's most recent order", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="NUMBER_OF_ORDERS", - description="Count of the number of orders a customer has placed", - meta_fields={"display_name": "order_count"}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="TOTAL_ORDER_AMOUNT", - description="Total value (AUD) of a customer's orders", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_orders", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - columns=[ - MetabaseColumn( - name="ORDER_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="STATUS", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_payments", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - columns=[ - MetabaseColumn( - name="PAYMENT_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - MetabaseColumn( - name="PAYMENT_METHOD", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ), - ], - ), - MetabaseModel( - name="stg_customers", - schema="PUBLIC", - description="", - model_type=ModelType.nodes, - columns=[ - MetabaseColumn( - name="CUSTOMER_ID", - description="", - meta_fields={}, - semantic_type=None, - visibility_type=None, - fk_target_table=None, - fk_target_field=None, - ) - ], - ), -] - - -class MockMetabaseClient(MetabaseClient): - def api(self, method: str, path: str, critical: bool = True, **kwargs): - if method == "get": - json_path = Path.joinpath( - FIXTURES_PATH, "mock_api", *f"{path.lstrip('/')}.json".split("/") - ) - if json_path.exists(): - with open(json_path, encoding="utf-8") as f: - return json.load(f) - return {} - - -class TestMetabaseClient(unittest.TestCase): - def setUp(self): - self.client = MockMetabaseClient( - url="http://localhost:3000", - session_id="dummy", - ) - logging.getLogger(__name__) - logging.basicConfig(level=logging.DEBUG) - TMP_PATH.mkdir(exist_ok=True) - - def _assert_exposures(self, expected_path: Path, actual_path: Path): - with open(expected_path, encoding="utf-8") as f: - expected = yaml.safe_load(f) - with open(actual_path, encoding="utf-8") as f: - actual = yaml.safe_load(f) - - self.assertEqual( - sorted(expected["exposures"], key=itemgetter("name")), - actual["exposures"], - ) - - def test_exposures(self): - fixtures_path = FIXTURES_PATH / "exposure" / "default" - output_path = TMP_PATH / "exposure" / "default" - job = _ExtractExposuresJob( - client=self.client, - models=MODELS, - output_path=str(output_path), - output_grouping=None, - include_personal_collections=False, - collection_includes=None, - collection_excludes=None, - ) - job.execute() - - self._assert_exposures( - fixtures_path / "exposures.yml", - output_path / "exposures.yml", - ) - - def test_exposures_collection_grouping(self): - fixtures_path = FIXTURES_PATH / "exposure" / "collection" - output_path = TMP_PATH / "exposure" / "collection" - job = _ExtractExposuresJob( - client=self.client, - models=MODELS, - output_path=str(output_path), - output_grouping="collection", - include_personal_collections=False, - collection_includes=None, - collection_excludes=None, - ) - job.execute() - - self._assert_exposures( - fixtures_path / "a_look_at_your_customers_table.yml", - output_path / "a_look_at_your_customers_table.yml", - ) - self._assert_exposures( - fixtures_path / "our_analytics.yml", - output_path / "our_analytics.yml", - ) - - def test_exposures_type_grouping(self): - fixtures_path = FIXTURES_PATH / "exposure" / "type" - output_path = TMP_PATH / "exposure" / "type" - job = _ExtractExposuresJob( - client=self.client, - models=MODELS, - output_path=str(output_path), - output_grouping="type", - include_personal_collections=False, - collection_includes=None, - collection_excludes=None, - ) - job.execute() - - for i in range(1, 18): - self._assert_exposures( - fixtures_path / "card" / f"{i}.yml", - output_path / "card" / f"{i}.yml", - ) - - for i in range(1, 2): - self._assert_exposures( - fixtures_path / "dashboard" / f"{i}.yml", - output_path / "dashboard" / f"{i}.yml", - ) - - def test_build_lookups(self): - job = _ExportModelsJob( - client=self.client, - database="unit_testing", - models=[], - exclude_sources=True, - sync_timeout=0, - ) - - expected_tables = [ - "PUBLIC.CUSTOMERS", - "PUBLIC.ORDERS", - "PUBLIC.RAW_CUSTOMERS", - "PUBLIC.RAW_ORDERS", - "PUBLIC.RAW_PAYMENTS", - "PUBLIC.STG_CUSTOMERS", - "PUBLIC.STG_ORDERS", - "PUBLIC.STG_PAYMENTS", - ] - actual_tables = job._load_tables(database_id="2") - self.assertEqual(expected_tables, list(actual_tables.keys())) - - expected_columns = [ - [ - "CUSTOMER_ID", - "FIRST_NAME", - "LAST_NAME", - "FIRST_ORDER", - "MOST_RECENT_ORDER", - "NUMBER_OF_ORDERS", - "CUSTOMER_LIFETIME_VALUE", - ], - [ - "ORDER_ID", - "CUSTOMER_ID", - "ORDER_DATE", - "STATUS", - "CREDIT_CARD_AMOUNT", - "COUPON_AMOUNT", - "BANK_TRANSFER_AMOUNT", - "GIFT_CARD_AMOUNT", - "AMOUNT", - ], - ["ID", "FIRST_NAME", "LAST_NAME"], - ["ID", "USER_ID", "ORDER_DATE", "STATUS"], - ["ID", "ORDER_ID", "PAYMENT_METHOD", "AMOUNT"], - ["CUSTOMER_ID", "FIRST_NAME", "LAST_NAME"], - ["ORDER_ID", "CUSTOMER_ID", "ORDER_DATE", "STATUS"], - ["PAYMENT_ID", "ORDER_ID", "PAYMENT_METHOD", "AMOUNT"], - ] - for table, columns in zip(expected_tables, expected_columns): - self.assertEqual(columns, list(actual_tables[table]["fields"].keys()))