Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danthelion/dbt_cloud_run_cost
💸 package to calculate dbt Cloud usage-based cost 💸
https://github.com/danthelion/dbt_cloud_run_cost
dbt dbt-cloud dbt-packages dbtcloud
Last synced: 3 months ago
JSON representation
💸 package to calculate dbt Cloud usage-based cost 💸
- Host: GitHub
- URL: https://github.com/danthelion/dbt_cloud_run_cost
- Owner: danthelion
- Created: 2023-08-12T08:48:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-13T09:07:19.000Z (about 1 year ago)
- Last Synced: 2024-05-14T10:31:46.096Z (6 months ago)
- Topics: dbt, dbt-cloud, dbt-packages, dbtcloud
- Homepage:
- Size: 4.88 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-dbt - dbt_cloud_run_cost - Package to calculate dbt Cloud usage-based cost. (Packages)
README
# dbt_cloud_run_cost
> This run cost $0.78 based on 78 successfully executed models.
This package contains a macro that calculates the cost of successfully created models if they were run via dbt Cloud.
## Installation
Add the following to your `packages.yml` file:
```yaml
packages:
- package: danthelion/dbt_cloud_run_cost
version: ["0.4.0"]
```After that, run `dbt deps` to install the package.
## Usage
Call the macro as a post-hook in your `dbt_project.yml` file:
```yaml
on-run-end:
- "{{ dbt_cloud_run_cost.calculate_run_cost(results, False) }}"
```Function arguments:
- `results`: the `results` variable that is passed to the `on-run-end` hook.
- `dbt_cloud_only`: a boolean flag that restricts calculations to only dbt Cloud runs. Defaults to `False`.This is how it will look like after you run a job:
```bash
08:30:51
08:30:51 Running 1 on-run-end hook
08:30:51
08:30:51 This run cost $0.78 based on 78 successfully executed models.
08:30:51
08:30:51 1 of 1 START hook: analytics.on-run-end.0 ......................... [RUN]
08:30:51 1 of 1 OK hook: analytics.on-run-end.0 ............................ [OK in 0.00s]
08:30:51
08:30:51
08:30:51 Finished running 22 view models, 56 table models, 18 tests, 1 hook in 0 hours 10 minutes and 34.38 seconds (634.38s).
08:30:51
08:30:51 Completed successfully
08:30:51
08:30:51 Done. PASS=96 WARN=0 ERROR=0 SKIP=0 TOTAL=96
```