Skip to main content

a tool for flexibly loading schemas from bigquery into looker

Project description

looker-loader

Write rules for how you want fields and measures to be generated from tables into looker.

Are you tired of adding timeframes to dimension_groups manually, of defining simple measures, of adding descriptions to measures? looker_loader removes a lot of the tedious work involved with loading new tables into Looker.

Define field_label, group_label, value_format_name etc in a common source of truth

If you find discrepancies in value formats and labelling across tables to be annoying and tedious, wouldnt it be nice to be able to input a label one place, and have it applied for every table? Looker_loader enables this.

Setup scheduled refreshes of lookml automatically

Fed up with generating new autogenerated tables every time a new field is added to a table? Use looker_loader to refresh tables on a schedule!

Quick Start

  1. Install the package:

    uv add looker_loader
    
  2. Create configuration files:

    • loader_config.yml - Define your BigQuery connections and settings
    • loader_recipe.yml - Define rules for field transformations

loader_config.yml

This file defines your BigQuery connections and loader settings:

config:
  loader:
    lexicanum: true
    output_path: ./views
  bigquery:
    - project_id: "your-project-id"
      dataset_id: "your_dataset"
      config:
        regex_include: "^fct_|^dim_|^obt_"
        regex_exclude: "_temp$|_backup$"

loader_recipe.yml

This file defines rules for how different field types should be transformed:

recipes:
  - name: primary_key
    filters:
      field_order: [0]
    dimension:
      primary_key: true

  - name: hide_records
    filters:
      db_types: [RECORD]
    dimension:
      hidden: true

  - name: group_ids
    dimension:
      group_label: Identifiers
      value_format_name: id
      measures:
        - type: count_distinct
    filters:
      regex_include: _id$|^pk.*_|_code$

  - name: numbers
    filters:
      types: [number]
      regex_exclude: _id$|^pk_|_code$
    dimension:
      group_label: Numbers
      value_format_name: decimal_1
      measures:
        - type: sum
          label: "Sum {{ parent_label }}"

  - name: time_date_values
    filters:
      regex_include: _date
      types: [date]
    dimension:
      timeframes:
        - raw
        - time
        - date
        - week
        - month
        - quarter
        - year
  1. Run the loader:
    uv run looker_loader
    

Check the Output

The loader will create LookML files in your specified output directory (default: ./views). You should see files like:

views/
├── fct_sales.view.lkml
├── dim_customers.view.lkml
└── obt_daily_summary.view.lkml

Common Issues

No tables found

  • Check your project_id and dataset_id are correct
  • Verify your BigQuery permissions
  • Check if your regex_include pattern matches any tables

Authentication errors

  • Ensure your Google Cloud credentials are properly set up

Next Steps

Now that you have the basics working:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

looker_loader-0.1.46.tar.gz (111.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

looker_loader-0.1.46-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file looker_loader-0.1.46.tar.gz.

File metadata

  • Download URL: looker_loader-0.1.46.tar.gz
  • Upload date:
  • Size: 111.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.2

File hashes

Hashes for looker_loader-0.1.46.tar.gz
Algorithm Hash digest
SHA256 629c599686a0bfa31f6bd0512fc89f6d0696e41d09ab5fa28740a5f89e00b675
MD5 409d8c754e617d3dff7f6aaec73b4d9e
BLAKE2b-256 e81e58e4645323f3d5c5a78eea56ff380bb556d6618ff4e83b7a3a67c2c41170

See more details on using hashes here.

File details

Details for the file looker_loader-0.1.46-py3-none-any.whl.

File metadata

File hashes

Hashes for looker_loader-0.1.46-py3-none-any.whl
Algorithm Hash digest
SHA256 198d4c2f17ad2f7ebd3f047580f4ccaefc41478b74d3dae29b6da8ea6bd5fe30
MD5 9a35e1ba0719a04fcb495f20452a6e02
BLAKE2b-256 2b8ade09e8440cb60d20db6c99492cc8e281c23fa8376408da7843314bbe8c36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page