Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lightdash/dbt2looker
Generate lookml for views from dbt models
https://github.com/lightdash/dbt2looker
dbt looker
Last synced: 3 months ago
JSON representation
Generate lookml for views from dbt models
- Host: GitHub
- URL: https://github.com/lightdash/dbt2looker
- Owner: lightdash
- License: mit
- Created: 2021-04-13T08:51:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-20T13:04:11.000Z (6 months ago)
- Last Synced: 2024-09-18T10:36:17.425Z (5 months ago)
- Topics: dbt, looker
- Language: Python
- Homepage: https://lightdash.com
- Size: 674 KB
- Stars: 176
- Watchers: 11
- Forks: 43
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-dbt - dbt2looker - Generate Looker views for dbt models. (Packages)
README
# dbt2looker
Use `dbt2looker` to generate Looker view files automatically from dbt models.
Want a deeper integration between dbt and your BI tool? You should also checkout [Lightdash - the open source alternative to Looker](https://github.com/lightdash/lightdash)
**Features**
* **Column descriptions** synced to looker
* **Dimension** for each column in dbt model
* **Dimension groups** for datetime/timestamp/date columns
* **Measures** defined through dbt column `metadata` [see below](#defining-measures)
* Looker types
* Warehouses: BigQuery, Snowflake, Redshift (postgres to come)[![demo](https://raw.githubusercontent.com/hubble-data/dbt2looker/main/docs/demo.gif)](https://asciinema.org/a/407407)
## Quickstart
Run `dbt2looker` in the root of your dbt project *after compiling looker docs*.
**Generate Looker view files for all models:**
```shell
dbt docs generate
dbt2looker
```**Generate Looker view files for all models tagged `prod`**
```shell
dbt2looker --tag prod
```## 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# Run
dbt2looker
```**Build from source**
Requires [poetry](https://python-poetry.org/docs/) 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/[email protected]/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:
```yaml
models:
- name: pages
columns:
- name: url
description: "Page url"
- name: event_id
description: unique event id for page view
meta:
measures:
page_views:
type: count
```