Skip to content

Commit ba38da0

Browse files
Add dbt commands and Feast CLI integration testing with SQLite
Co-authored-by: franciscojavierarceo <4163062+franciscojavierarceo@users.noreply.github.com>
1 parent e25d08f commit ba38da0

File tree

9 files changed

+72
-9
lines changed

9 files changed

+72
-9
lines changed

.github/workflows/dbt-integration-tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,47 @@ jobs:
3434
- name: Install dependencies
3535
run: make install-python-dependencies-ci
3636

37+
- name: Install dbt and dbt-duckdb
38+
run: |
39+
uv pip install --system dbt-core dbt-duckdb
40+
41+
- name: Run dbt commands
42+
run: |
43+
cd sdk/python/tests/integration/dbt/test_dbt_project
44+
dbt deps
45+
dbt build
46+
dbt test
47+
48+
- name: Setup Feast project for dbt import test
49+
run: |
50+
cd sdk/python/tests/integration/dbt
51+
mkdir -p feast_repo
52+
cd feast_repo
53+
cat > feature_store.yaml << EOF
54+
project: feast_dbt_test
55+
registry: data/registry.db
56+
provider: local
57+
online_store:
58+
type: sqlite
59+
path: data/online_store.db
60+
EOF
61+
mkdir -p data
62+
63+
- name: Test feast dbt import
64+
run: |
65+
cd sdk/python/tests/integration/dbt/feast_repo
66+
feast -c feature_store.yaml dbt import \
67+
-m ../test_dbt_project/target/manifest.json \
68+
-e driver_id \
69+
-d file \
70+
--tag feast
71+
72+
- name: Verify feast objects were created
73+
run: |
74+
cd sdk/python/tests/integration/dbt/feast_repo
75+
feast -c feature_store.yaml feature-views list
76+
feast -c feature_store.yaml entities list
77+
3778
- name: Run dbt integration tests
3879
run: |
3980
cd sdk/python

sdk/python/tests/integration/dbt/test_dbt_project/dbt_project.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ profile: 'test'
88
# Model directory
99
model-paths: ["models"]
1010

11+
# Seed directory
12+
seed-paths: ["seeds"]
13+
1114
# Target directory where manifest.json will be generated
1215
target-path: "target"
1316

1417
# Configure models
1518
models:
1619
feast_integration_test:
1720
+materialized: table
21+
22+
# Configure seeds
23+
seeds:
24+
feast_integration_test:
25+
+schema: raw

sdk/python/tests/integration/dbt/test_dbt_project/models/customer_features.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ SELECT
77
total_orders,
88
total_spent,
99
avg_order_value
10-
FROM {{ source('raw_data', 'customer_stats') }}
10+
FROM {{ ref('customer_stats') }}

sdk/python/tests/integration/dbt/test_dbt_project/models/driver_features.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ SELECT
77
conv_rate,
88
acc_rate,
99
avg_daily_trips
10-
FROM {{ source('raw_data', 'driver_hourly_stats') }}
10+
FROM {{ ref('driver_hourly_stats') }}

sdk/python/tests/integration/dbt/test_dbt_project/models/product_features.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ SELECT
77
view_count,
88
purchase_count,
99
rating_avg
10-
FROM {{ source('raw_data', 'product_stats') }}
10+
FROM {{ ref('product_stats') }}

sdk/python/tests/integration/dbt/test_dbt_project/models/schema.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
version: 2
22

3-
sources:
4-
- name: raw_data
5-
tables:
6-
- name: driver_hourly_stats
7-
- name: customer_stats
8-
- name: product_stats
3+
# Seeds will be loaded as tables
4+
seeds:
5+
- name: driver_hourly_stats
6+
description: "Raw driver hourly statistics"
7+
- name: customer_stats
8+
description: "Raw customer statistics"
9+
- name: product_stats
10+
description: "Raw product statistics"
911

1012
models:
1113
- name: driver_features
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
customer_id,event_timestamp,total_orders,total_spent,avg_order_value
2+
cust_001,2024-01-01 00:00:00,5,250.50,50.10
3+
cust_002,2024-01-01 00:00:00,3,180.75,60.25
4+
cust_003,2024-01-01 00:00:00,7,420.00,60.00
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
driver_id,event_timestamp,conv_rate,acc_rate,avg_daily_trips
2+
1001,2024-01-01 00:00:00,0.85,0.92,12
3+
1002,2024-01-01 00:00:00,0.78,0.88,15
4+
1003,2024-01-01 00:00:00,0.91,0.95,10
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
product_id,event_timestamp,view_count,purchase_count,rating_avg
2+
prod_001,2024-01-01 00:00:00,150,25,4.5
3+
prod_002,2024-01-01 00:00:00,200,30,4.2
4+
prod_003,2024-01-01 00:00:00,100,15,4.8

0 commit comments

Comments
 (0)