Skip to content

Commit

Permalink
dbt macro that projects require
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Gouline committed Dec 13, 2019
1 parent 69feac5 commit 55a0834
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,8 @@ dmypy.json

# IDE
.vscode/

# dbt
target/
dbt_modules/
logs/
9 changes: 9 additions & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion dbtmetabase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
49 changes: 49 additions & 0 deletions macros/tests.sql
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit 55a0834

Please sign in to comment.