Skip to main content

The open source metrics layer.

Project description

Metrics Layer

Build Status codecov Code style: black

What is a Metrics Layer?

Metrics Layer is an open source project with the goal of making access to metrics consistent throughout an organization. We believe you should be able to access consistent metrics from any tool you use to access data. This metrics layer is designed to work with Zenlytic as a BI tool.

How does it work?

Right now, there are two supported BI tools, Zenlytic and Looker. The Metrics Layer will read your data model and give you the ability to access those metrics and dimensions in a python client library, or through SQL with a special MQL tag.

Sound interesting? Here's how to set Metrics Layer up with your data model and start querying your metrics in in under 2 minutes.

Installation

Make sure that your data warehouse is one of the supported types. Metrics Layer currently supports Snowflake, BigQuery and Redshift, and only works with python >= 3.7.

Install Metrics Layer with the appropriate extra for your warehouse

For Snowflake run pip install metrics-layer[snowflake]

For BigQuery run pip install metrics-layer[bigquery]

For Redshift run pip install metrics-layer[redshift]

Profile set up

There are several ways to set up a profile, we're going to look at the fastest one here.

The fastest way to get connected is to pass the necessary information directly into Metrics Layer. Once you've installed the library with the warehouse you need, you should be able to run the code snippet below and start querying.

You'll pull the repo from Github for this example.

from metrics_layer import MetricsLayerConnection

# Give metrics_layer the info to connect to your data model and warehouse
config = {
  "repo_url": "https://myusername:myaccesstoken@github.com/myorg/myrepo.git",
  "branch": "develop",
  "connections": [
    {
      "name": "mycompany",              # The name of the connection in your data model (you'll see this in model files)
      "type": "snowflake",
      "account": "2e12ewdq.us-east-1",
      "username": "demo_user",
      "password": "q23e13erfwefqw",
      "database": "ANALYTICS",
      "schema": "DEV",                  # Optional
    }
  ],
}
conn = MetricsLayerConnection(config)

# You're off to the races. Query away!
df = conn.query(metrics=["total_revenue"], dimensions=["channel", "region"])

That's it.

For more advanced methods of connection and more information about the project check out the docs.

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

metrics_layer-0.8.22.tar.gz (71.6 kB view details)

Uploaded Source

Built Distribution

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

metrics_layer-0.8.22-py3-none-any.whl (88.0 kB view details)

Uploaded Python 3

File details

Details for the file metrics_layer-0.8.22.tar.gz.

File metadata

  • Download URL: metrics_layer-0.8.22.tar.gz
  • Upload date:
  • Size: 71.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b1 CPython/3.8.11 Darwin/21.6.0

File hashes

Hashes for metrics_layer-0.8.22.tar.gz
Algorithm Hash digest
SHA256 6f8a956510c80586fcac9591150523676561e46fe0a5cc867030ad50cbc46e55
MD5 e2d902ccb82410639c03114bfdd5da86
BLAKE2b-256 2f6b59fa1b3ec25c7c567324216bcf6cbc2e2ad0cbcf2896e2f52ade15cdeb60

See more details on using hashes here.

File details

Details for the file metrics_layer-0.8.22-py3-none-any.whl.

File metadata

  • Download URL: metrics_layer-0.8.22-py3-none-any.whl
  • Upload date:
  • Size: 88.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b1 CPython/3.8.11 Darwin/21.6.0

File hashes

Hashes for metrics_layer-0.8.22-py3-none-any.whl
Algorithm Hash digest
SHA256 f579c1ae185b9c52a65e58d90be19c332a06ea0ba697e55253c4075261a2a14a
MD5 382ec715321d255217be0d01c018838f
BLAKE2b-256 98ad74163c9f90efcda15aca70b20556b1d612e63d1f61b743ea976bc28f5238

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