Generate lookml view files from dbt models for Bigquery
Project description
dbt2looker
Use dbt2looker-bigquery
to generate Looker view files automatically from dbt models in Bigquery.
This is a fork of dbt2looker that is specific to bigquery. The intention is to allow one to define most of the simple and tedious lookml settings in dbt. That way the lookml code gets less bloated, and can be more focused on advanced metrics and explores.
Want a deeper integration between dbt and your BI tool? You should also checkout Lightdash - the open source alternative to Looker
Features
- Column descriptions synced to looker
- Dimension for each column in dbt model
- Define Dimensions define common lookml settings in dbt like label, group label, hidden
- Opinionated Primary key automatically set the first column to be the primary key, and hide it.
- Dimension groups for datetime/timestamp/date columns
- Measures defined through dbt column
metadata
see below - Looker types
- Warehouses: BigQuery
Quickstart
Run dbt2looker
in the root of your dbt project after compiling looker docs.
Generate Looker view files for all models:
dbt docs generate
dbt2looker
Generate Looker view files for all models tagged prod
dbt2looker --tag prod
**Generate Looker view files for all exposed models **
dbt2looker --exposed_only
Install
Install from PyPi repository
Install from pypi into a fresh virtual environment.
# Create virtual env
python3.7 -m venv dbt2looker-venv
source dbt2looker-venv/bin/activate
# Install
pip install dbt2looker-bigquery
# Run
dbt2looker
Build from source
Requires poetry and python >=3.7
For development, it is recommended to use python 3.7:
# Ensure you're using 3.7
poetry env use 3.7
# alternative: poetry env use /usr/local/opt/python@3.7/bin/python3
# Install dependencies and main package
poetry install
# Run dbtlooker in poetry environment
poetry run dbt2looker
Defining measures
You can define looker measures in your dbt schema.yml
files. For example:
models:
- name: pages
columns:
- name: url
description: "Page url"
- name: event_id
description: unique event id for page view
meta:
looker:
hidden: True
label: event
group_label: identifiers
value_format_name: id
looker_measures:
- type: count_distinct
sql_distinct_key: ${url}
- type: count
value_format_name: decimal_1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dbt2looker_bigquery-0.12.13.tar.gz
.
File metadata
- Download URL: dbt2looker_bigquery-0.12.13.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e6888d369abe30bd5b6706854153fa433b24d2cea911d312edac311e38e6165 |
|
MD5 | 822439b8f9251524ab6eb4cf0482432b |
|
BLAKE2b-256 | b5989fd5bf8f584f34e509cdddb9b0d14dc2065afdfde618802801e16c4e72f9 |
File details
Details for the file dbt2looker_bigquery-0.12.13-py3-none-any.whl
.
File metadata
- Download URL: dbt2looker_bigquery-0.12.13-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 274911c320c347ccde9d75e9023a6ee5b9b2e1ac083c81598c6d3383a9e6b5e1 |
|
MD5 | eb52e9a96c1015c577fb4b64d08b0881 |
|
BLAKE2b-256 | c03bde7d9995caae5b7d0bd3e23c4d031f21ab17ba6dde1271c2ddc6e327f717 |