Skip to main content

No project description provided

Project description

Semantic Layer Tool

This tool is a command line interface (CLI) to interact with your Preset workspaces. Currently it can be used to sync resources (databases, datasets, charts, dashboards) from source control, either in native format or from a dbt <https://www.getdbt.com/>_ project. It can also be used to run SQL against any database in any workspace. In the future, the CLI will also allow you to manage your workspaces and users.

Installation

pip install "git+https://gitlab.hebela.vn/data/semantic-layer-tool.git"

Usage

The following commands are currently available:

  • superset-cli sql: run SQL interactively or programmatically against an analytical database.
  • superset-cli export-assets (alternatively, superset-cli export): export resources (databases, datasets, charts, dashboards) into a directory as YAML files.
  • superset-cli export-ownership: export resource ownership (UUID -> email) into a YAML file.
  • superset-cli export-rls: export RLS rules into a YAML file.
  • superset-cli export-roles: export user roles into a YAML file.
  • superset-cli export-users: export users (name, username, email, roles) into a YAML file.
  • superset-cli sync native (alternatively, superset-cli import-assets): synchronize the workspace from a directory of templated configuration files.
  • superset-cli sync dbt-core: synchronize the workspace from a dbt Core project.
  • superset-cli sync dbt-cloud: synchronize the workspace from a dbt Cloud project.

Synchronizing to and from dbt

The CLI also allows you to synchronize models, and metrics from a dbt project.

   % superset-cli  --jwt-token=JWT_TOEKN https://dev.bi.hebela.vn/ \
   > sync dbt-core --project=my_project --target=dev --profiles=profiles.yml \
   > /path/to/dbt/my_project/target/manifest.json \
   > --external-url-prefix=http://localhost:8080/

Running this command will:

  1. Read the dbt profile and create the $target database for the specified project in the Preset workspace.
  2. Every source in the project will be created as a dataset in the Preset workspace.
  3. Every model in the project will be created as a dataset in the Preset workspace.
  4. Any metrics <https://docs.getdbt.com/docs/building-a-dbt-project/metrics>_ will be added to the corresponding datasets.
  5. Every dashboard built on top of the dbt sources and/or models will be synchronized back to dbt as an exposure <https://docs.getdbt.com/docs/building-a-dbt-project/exposures>_.

Descriptions, labels and other metadata is also synced from dbt models to the corresponding fields in the dataset. It's also possible to specify values for Superset-only fields directly in the model definition, under model.meta.superset.{{field_name}}. For example, to specify the cache timeout for a dataset:

    models:
      - name: my_dbt_model
        meta:
          superset:
            cache_timeout: 250 # Setting the dataset cache timeout to 250. 

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

semantic_layer_tool-1.0.0.tar.gz (441.2 kB view details)

Uploaded Source

File details

Details for the file semantic_layer_tool-1.0.0.tar.gz.

File metadata

  • Download URL: semantic_layer_tool-1.0.0.tar.gz
  • Upload date:
  • Size: 441.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for semantic_layer_tool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dda33ee2574b71a76e9d172b1756e2c7db9dc23c1b44883859de8c070fdca06e
MD5 c7e48c06ba63f8f569269ce9c6f3d3bc
BLAKE2b-256 f37cb2675309c33bcdf79345c8227cca804945e957aad5524cebd98d78959254

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