From 55a0834d679172bfb316825061802616af262c47 Mon Sep 17 00:00:00 2001 From: Mike Gouline Date: Fri, 13 Dec 2019 13:54:09 +1100 Subject: [PATCH] dbt macro that projects require --- .gitignore | 5 +++++ dbt_project.yml | 9 ++++++++ dbtmetabase/__init__.py | 2 +- macros/tests.sql | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 dbt_project.yml create mode 100644 macros/tests.sql diff --git a/.gitignore b/.gitignore index f872e933..08de55cf 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,8 @@ dmypy.json # IDE .vscode/ + +# dbt +target/ +dbt_modules/ +logs/ diff --git a/dbt_project.yml b/dbt_project.yml new file mode 100644 index 00000000..18ac7c1b --- /dev/null +++ b/dbt_project.yml @@ -0,0 +1,9 @@ +name: 'dbt_metabase' +version: '0.1.1' + +target-path: "target" +clean-targets: ["target", "dbt_modules"] +macro-paths: ["macros"] +log-path: "logs" + +require-dbt-version: ">=0.13.0" \ No newline at end of file diff --git a/dbtmetabase/__init__.py b/dbtmetabase/__init__.py index 4b915365..5ba7ec17 100644 --- a/dbtmetabase/__init__.py +++ b/dbtmetabase/__init__.py @@ -3,7 +3,7 @@ from .dbt import DbtReader from .metabase import MetabaseClient -__version__ = '0.1.0' +__version__ = '0.1.1' def export(dbt_path: str, mb_host: str, mb_user: str, mb_password: str, diff --git a/macros/tests.sql b/macros/tests.sql new file mode 100644 index 00000000..07a9c5f1 --- /dev/null +++ b/macros/tests.sql @@ -0,0 +1,49 @@ +{% macro test_metabase(model, column_name, special_type) -%} +select '{{ special_type }}' as type where type not in ( + 'type/AvatarURL', + 'type/Category', + 'type/City', + 'type/Country', + 'type/Currency', + 'type/Description', + 'type/Email', + 'type/Enum', + 'type/ImageURL', + 'type/SerializedJSON', + 'type/Latitude', + 'type/Longitude', + 'type/Number', + 'type/State', + 'type/URL', + 'type/ZipCode', + 'type/Quantity', + 'type/Income', + 'type/Discount', + 'type/CreationTimestamp', + 'type/CreationTime', + 'type/CreationDate', + 'type/CancelationTimestamp', + 'type/CancelationTime', + 'type/CancelationDate', + 'type/DeletionTimestamp', + 'type/DeletionTime', + 'type/DeletionDate', + 'type/Product', + 'type/User', + 'type/Source', + 'type/Price', + 'type/JoinTimestamp', + 'type/JoinTime', + 'type/JoinDate', + 'type/Share', + 'type/Owner', + 'type/Company', + 'type/Subscription', + 'type/Score', + 'type/Title', + 'type/Comment', + 'type/Cost', + 'type/GrossMargin', + 'type/Birthdate' +); +{%- endmacro %}