████████▄ ▄████████ ▄▄▄▄███▄▄▄▄ ███▄▄▄▄
███ ▀███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ███▀▀▀██▄
███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ▀███████████ ███ ███ ███ ███ ███
███ ███ ███ ███ ███ ███ ███ ███ ███
███ ▄███ ███ ███ ███ ███ ███ ███ ███
████████▀ ███ █▀ ▀█ ███ █▀ ▀█ █▀
Data Asset Metrics Navigator
The DAMN tool extracts and reports metrics about your data assets.
It allows you to inspect your assets, lineage, and all sorts of metrics around materialization, usage, physical space usage and query performance. The objective of the DAMN tool is to give you a convenient command-line tool to track and report on the data assets you're working on.
Installation
To install the DAMN tool, run the following command:
pip install damn-tool
Connectors
The DAMN tool leverages various connectors to interact with different service providers.
Configurations
Configuring these connectors is done via a YAML file located at ~/.damn/connectors.yml. You can override the location of those connector configurations using the --configs-dir option.
See example configuration file here
The configuration file uses the following structure:
connector_type:
service_provider:
param1: value1
param2: value2
- connector_type: The name of the connector (e.g., orchestrator, io-manager, data-warehouse, etc.).
- service_provider: The name of the service provider for the connector. You can have multiple providers per connector.
- param1, param2, etc.: The parameters needed for each connector. The required parameters will depend on the specific connector. For example, a Dagster connector might require endpoint and api_token.
Connector types
Orchestrator
This is the default connector required by the DAMN tool. For now, we only support Dagster as the service provider for this connector. Here's an example configuration for an orchestrator connector with a dagster profile:
orchestrator:
dagster:
endpoint: https://your-dagster-instance.com/prod/graphql
api_token: your-api-token
IO Manager
Your assets can be stored in storage services. For now, we only support the AWS storage service. This can be configured like this.
io-manager:
aws:
credentials:
access_key_id: "{{ env('AWS_ACCESS_KEY_ID') }}"
secret_access_key: "{{ env('AWS_SECRET_ACCESS_KEY') }}"
region: "us-east-1"
bucket_name: "bucket-name"
key_prefix: "asset-prefix"
Data Warehouses
Your assets can be materialized to a data warehouse. For now, we support both Snowflake and BigQuery. This can be configured like this.
data-warehouse:
snowflake:
account: ab1234.us-east-1
user: username
password: "{{ env('SNOWFLAKE_PASSWORD') }}"
role: my-role
database: my-database
warehouse: my-warehouse
schema: analytics
bigquery:
keyfile: "{{ env('GOOGLE_APPLICATION_CREDENTIALS') }}"
project: "XYZ"
Switching Between Service Providers
The active service provider for each connector can be changed by specifying the service provider when running DAMN commands. By default, DAMN will use the first service provider configured for each connector.
Example usage:
damn ls --orchestrator dagster --io-manager aws --data-warehouse snowflake
Usage
The DAMN tool is both a CLI tool and a python library.
Output option
Note that in CLI model, commands support an output option which allows flexibility in how the DAMN tool might be used:
terminal: By default, the output of commands will be printed to the terminaljson: You can also have the output as ajsonobject, which is more useful if you're to use DAMN in a programmatic way.copy: You can also copy the output to your clipboard, which is useful if you want to share an asset's metrics in a PR for example.
List assets
In python...
from damn_tool.ls import list_assets
result = list_assets()
print(result)
From the command line...
foo@bar:~$ damn ls
- airbyte/protest_groupings
- data_warehouse/movements_dim
- data_warehouse/observations_fct
- gdelt/gdelt_gkg_articles
- gdelt/gdelt_mention_summaries
- hex/hex_main_dashboard_refresh
- semantic_definitions
List all assets for a specifc key group In python...
from damn_tool.ls import list_assets
result = list_assets(prefix='gdelt')
print(result)
From the command line...
foo@bar:~$ damn ls --prefix gdelt
- gdelt/gdelt_article_summaries
- gdelt/gdelt_articles_enhanced
- gdelt/gdelt_events
- gdelt/gdelt_gkg_articles
- gdelt/gdelt_mention_summaries
- gdelt/gdelt_mentions
- gdelt/gdelt_mentions_enhanced
Show details for a specific asset
In python...
from damn_tool.show import show_asset
result = show_asset('gdelt/gdelt_articles_enhanced')
print(result)
From the command line...
foo@bar:~$ damn show gdelt/data_warehouse/integration/int__events_actors
From orchestrator:
- description: dbt model int__events_actors
- computeKind: dbt
- policyType: LAZY
- maximumLagMinutes: 360.0
- cronSchedule: None
- isPartitioned: False
- dependedByKeys:
- data_warehouse
- events_actors_bridge
- dependencyKeys:
- data_warehouse
- integration
- int__events_observations
- data_warehouse
- integration
- int__actors
- metadataEntries:
- Execution Duration: 4.183706
From data warehouse:
- table_schema: analytics_integration
- table_type: base table
- created: 2023-07-05T08:36:40.935000-07:00
- last_altered: 2023-07-19T09:56:36.410000-07:00
Show metrics for a specific asset
In python...
from damn_tool.metrics import asset_metrics
result = asset_metrics('gdelt/gdelt_articles_enhanced')
print(result)
From the command line...
foo@bar:~$ damn metrics gdelt/gdelt_gkg_articles
From orchestrator:
- run_id: 03466ceb-1c51-43ab-9384-33b6472c3f24
- status: SUCCESS
- start_time: 2023-07-19 14:19:00
- end_time: 2023-07-19 14:19:02
- elapsed_time: 0:00:02.563292
- num_partitions: 4963
- num_materialized: 4963
- num_failed: 0
From IO manager:
- files: 4976
- size: 76.25 MB
- last_modified: 2023-07-19T18:19:03+00:00
From data warehouse:
- row_count: None
- bytes: N/A
Contribution
Contributions to the DAMN tool are always welcome. Whether it's feature requests, bug fixes, or new features, your contribution is appreciated.
License
The DAMN tool is open-source software, licensed under MIT.
Metadata
Release files for damn-tool 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| damn_tool-0.1.5.tar.gz | 13.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| damn_tool-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.5 kB
Release files / damn_tool-0.1.5.tar.gz
| Download URL | damn_tool-0.1.5.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da30bd87eb7e12d917311ea3c34db4ddd5df5faf65c02003bec3dc6ddc8f79a4
|
|
BLAKE2b-256 checksum How to use checksums |
fc4dc7124e27628906387149490402ddc1c931316119ead205f4d9ba8e0cb9de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.4 Darwin/24.1.0
|
Release files / damn_tool-0.1.5-py3-none-any.whl
| Download URL | damn_tool-0.1.5-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54c9ba5b29b99b813c503ac0d2f00fbbfc3a50981bd15859b04e4163ac867ed9
|
|
BLAKE2b-256 checksum How to use checksums |
063b57e1a6f145317bec6ce61b3e9745c61a7f1eb4827276c3864794bdbe385c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.9.4 Darwin/24.1.0
|
Security for damn-tool 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.