Skip to content

Commit d27b6fb

Browse files
Merge pull request #187 from digitalghost-dev/1.7.0
1.7.0
2 parents 1adcde8 + 6f85f4f commit d27b6fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1752
-81
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ on:
3030
- main
3131

3232
env:
33-
VERSION_NUMBER: 'v1.6.2'
33+
VERSION_NUMBER: 'v1.7.0'
3434
DOCKERHUB_REGISTRY_NAME: 'digitalghostdev/poke-cli'
3535
AWS_REGION: 'us-west-2'
3636

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ card_data/.tmp*/**
6161

6262
card_data/pipelines/poke_cli_dbt/.user.yml
6363
/card_data/supabase/
64+
65+
card_data/~/

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ builds:
1414
- windows
1515
- darwin
1616
ldflags:
17-
- -s -w -X main.version=v1.6.2
17+
- -s -w -X main.version=v1.7.0
1818

1919
archives:
2020
- formats: [ 'zip' ]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN go mod download
88

99
COPY . .
1010

11-
RUN go build -ldflags "-X main.version=v1.6.2" -o poke-cli .
11+
RUN go build -ldflags "-X main.version=v1.7.0" -o poke-cli .
1212

1313
# build 2
1414
FROM --platform=$BUILDPLATFORM alpine:3.22

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img height="250" width="350" src="pokemon.svg" alt="pokemon-logo"/>
33
<h1>Pokémon CLI</h1>
44
<img src="https://img.shields.io/github/v/release/digitalghost-dev/poke-cli?style=flat-square&logo=git&logoColor=FFCC00&label=Release%20Version&labelColor=EEE&color=FFCC00" alt="version-label">
5-
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.6.2?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
5+
<img src="https://img.shields.io/docker/image-size/digitalghostdev/poke-cli/v1.7.0?arch=arm64&style=flat-square&logo=docker&logoColor=FFCC00&labelColor=EEE&color=FFCC00" alt="docker-image-size">
66
<img src="https://img.shields.io/github/actions/workflow/status/digitalghost-dev/poke-cli/ci.yml?branch=main&style=flat-square&logo=github&logoColor=FFCC00&label=CI&labelColor=EEE&color=FFCC00" alt="ci-status-badge">
77
</div>
88
<div align="center">
@@ -91,11 +91,11 @@ Cloudsmith is a fully cloud-based service that lets you easily create, store, an
9191
3. Choose how to interact with the container:
9292
* Run a single command and exit:
9393
```bash
94-
docker run --rm -it digitalghostdev/poke-cli:v1.6.2 <command> [subcommand] flag]
94+
docker run --rm -it digitalghostdev/poke-cli:v1.7.0 <command> [subcommand] flag]
9595
```
9696
* Enter the container and use its shell:
9797
```bash
98-
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.6.2 -c "cd /app && exec sh"
98+
docker run --rm -it --name poke-cli --entrypoint /bin/sh digitalghostdev/poke-cli:v1.7.0 -c "cd /app && exec sh"
9999
# placed into the /app directory, run the program with './poke-cli'
100100
# example: ./poke-cli ability swift-swim
101101
```
@@ -158,6 +158,7 @@ By running `poke-cli [-h | --help]`, it'll display information on how to use the
158158
│ │
159159
│ COMMANDS: │
160160
│ ability Get details about an ability │
161+
│ berry Get details about a berry │
161162
│ item Get details about an item │
162163
│ move Get details about a move │
163164
│ natures Get details about all natures │
@@ -182,7 +183,7 @@ Below is a list of the planned/completed commands and flags:
182183
183184
- [x] `ability`: get data about an ability.
184185
- [x] `-p | --pokemon`: display Pokémon that learn this ability.
185-
- [ ] `berry`: get data about a berry.
186+
- [x] `berry`: get data about a berry.
186187
- [x] `item`: get data about an item.
187188
- [x] `move`: get data about a move.
188189
- [ ] `-p | --pokemon`: display Pokémon that learn this move.

card_data/pipelines/defs/transformation/transform_data.py

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,17 @@
22
from dagster_dbt import DbtCliResource, dbt_assets
33
from pathlib import Path
44

5-
from ..load.load_data import (
6-
load_series_data,
7-
data_quality_check_on_series,
8-
load_set_data,
9-
load_card_data
10-
)
11-
125
DBT_PROJECT_PATH = Path(__file__).joinpath("..", "..", "..", "poke_cli_dbt").resolve()
136

14-
@dg.asset(deps=[load_series_data, data_quality_check_on_series, load_set_data, load_card_data], kinds=["dbt"])
15-
def dbt_transformation(context: dg.AssetExecutionContext):
16-
"""Run dbt build after all extract and load operations complete"""
17-
import subprocess
18-
import os
19-
20-
# Set environment variables for dbt
21-
env = os.environ.copy()
22-
env["SUPABASE_PASSWORD"] = os.getenv("SUPABASE_PASSWORD", "")
23-
24-
# Run dbt build
25-
result = subprocess.run(
26-
["dbt", "build"],
27-
cwd=str(DBT_PROJECT_PATH),
28-
env=env,
29-
capture_output=True,
30-
text=True
31-
)
32-
33-
if result.returncode != 0:
34-
context.log.error(f"dbt build failed: {result.stderr}")
35-
raise Exception(f"dbt build failed: {result.stderr}")
36-
37-
context.log.info(f"dbt build completed successfully: {result.stdout}")
38-
return "dbt build completed"
7+
@dbt_assets(manifest=DBT_PROJECT_PATH / "target" / "manifest.json")
8+
def poke_cli_dbt_assets(context: dg.AssetExecutionContext, dbt: DbtCliResource):
9+
"""
10+
dbt assets that transform staging data into final models.
11+
"""
12+
yield from dbt.cli(["build"], context=context).stream()
3913

40-
# Create definitions for this transformation
14+
dbt_resource = DbtCliResource(project_dir=DBT_PROJECT_PATH)
4115
defs = dg.Definitions(
42-
assets=[dbt_transformation]
16+
assets=[poke_cli_dbt_assets],
17+
resources={"dbt": dbt_resource}
4318
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'poke_cli_dbt'
2+
version: '1.7.0'
3+
4+
profile: 'poke_cli_dbt'
5+
6+
model-paths: ["models"]
7+
analysis-paths: ["analyses"]
8+
test-paths: ["tests"]
9+
seed-paths: ["seeds"]
10+
macro-paths: ["macros"]
11+
snapshot-paths: ["snapshots"]
12+
13+
# directories removed by 'dbt clean'
14+
clean-targets:
15+
- "target"
16+
- "dbt_packages"
17+
18+
models:
19+
poke_cli_dbt:
20+
# Transform staging data to public schema
21+
+materialized: table
22+
23+
on-run-end:
24+
- "{{ create_relationships() }}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% macro create_relationships() %}
2+
ALTER TABLE {{ ref('series') }} ADD CONSTRAINT pk_series PRIMARY KEY (id);
3+
ALTER TABLE {{ ref('sets') }} ADD CONSTRAINT pk_sets PRIMARY KEY (set_id);
4+
ALTER TABLE {{ ref('cards') }} ADD CONSTRAINT pk_cards PRIMARY KEY (id);
5+
{% endmacro %}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% macro enable_rls() %}
2+
ALTER TABLE {{ this }} ENABLE ROW LEVEL SECURITY;
3+
CREATE POLICY "Enable read access for all users" ON {{ this }} TO PUBLIC USING (true);
4+
{% endmacro %}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
{{ config(materialized='table') }}
1+
{{ config(
2+
materialized='table',
3+
post_hook="{{ enable_rls() }}"
4+
) }}
25

3-
SELECT id, image, name, "localId", category
4-
FROM {{ source('staging', 'cards') }}
6+
SELECT id, image, name, "localId", category, hp
7+
FROM {{ source('staging', 'cards') }}

0 commit comments

Comments
 (0)