Skip to content

Commit 0007661

Browse files
committed
PR feedback
1 parent 315c0d9 commit 0007661

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

.circleci/test_migration.sh

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/usr/bin/env bash
22
set -ex
33

4-
GATEWAY_NAME="duckdb_persistent"
5-
TMP_DIR=$(mktemp -d)
6-
SUSHI_DIR="$TMP_DIR/sushi"
7-
8-
94
if [[ -z $(git tag --points-at HEAD) ]]; then
105
# If the current commit is not tagged, we need to find the last tag
116
LAST_TAG=$(git describe --tags --abbrev=0)
@@ -14,28 +9,46 @@ else
149
LAST_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
1510
fi
1611

17-
git checkout $LAST_TAG
12+
function run_migration_test {
13+
TMP_DIR=$(mktemp -d)
14+
EXAMPLE_NAME="$1"
15+
SQLMESH_OPTS="$2"
16+
EXAMPLE_DIR="./examples/$EXAMPLE_NAME"
17+
TEST_DIR="$TMP_DIR/$EXAMPLE_NAME"
18+
19+
echo "Running migration test for '$EXAMPLE_NAME' in '$TEST_DIR' for example project '$EXAMPLE_DIR' using options '$SQLMESH_OPTS'"
20+
21+
git checkout $LAST_TAG
22+
23+
# Install dependencies from the previous release.
24+
make install-dev
25+
26+
cp -r $EXAMPLE_DIR $TEST_DIR
1827

19-
# Install dependencies from the previous release.
20-
make install-dev
28+
# this is only needed temporarily until the released tag for $LAST_TAG includes this config
29+
if [ "$EXAMPLE_NAME" == "sushi_dbt" ]; then
30+
echo 'migration_test_config = sqlmesh_config(Path(__file__).parent, dbt_target_name="duckdb")' >> $TEST_DIR/config.py
31+
fi
2132

22-
cp -r ./examples/sushi $TMP_DIR
33+
# Run initial plan
34+
pushd $TEST_DIR
35+
rm -rf ./data/*
36+
sqlmesh $SQLMESH_OPTS plan --no-prompts --auto-apply
37+
rm -rf .cache
38+
popd
2339

24-
# Run initial plan
25-
pushd $SUSHI_DIR
26-
rm -rf ./data/*
27-
sqlmesh --gateway $GATEWAY_NAME plan --no-prompts --auto-apply
28-
rm -rf .cache
29-
popd
40+
# Switch back to the starting state of the repository
41+
git checkout -
3042

31-
# Switch back to the starting state of the repository
32-
git checkout -
43+
# Install updated dependencies.
44+
make install-dev
3345

34-
# Install updated dependencies.
35-
make install-dev
46+
# Migrate and make sure the diff is empty
47+
pushd $TEST_DIR
48+
sqlmesh $SQLMESH_OPTS migrate
49+
sqlmesh $SQLMESH_OPTS diff prod
50+
popd
51+
}
3652

37-
# Migrate and make sure the diff is empty
38-
pushd $SUSHI_DIR
39-
sqlmesh --gateway $GATEWAY_NAME migrate
40-
sqlmesh --gateway $GATEWAY_NAME diff prod
41-
popd
53+
run_migration_test "sushi" "--gateway duckdb_persistent"
54+
run_migration_test "sushi_dbt" "--config migration_test_config"

examples/sushi_dbt/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
config = sqlmesh_config(Path(__file__).parent)
66

77
test_config = config
8+
9+
migration_test_config = sqlmesh_config(Path(__file__).parent, dbt_target_name="duckdb")

sqlmesh/core/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class DbtNodeInfo(PydanticModel):
183183

184184
fqn: str
185185
"""Used for selectors in --select/--exclude.
186-
Takes the filesystem into account so may be structured differently to :resource_name.
186+
Takes the filesystem into account so may be structured differently to :unique_id.
187187
188188
Examples:
189189
- jaffle_shop.staging.unique_stg_orders_order_id

0 commit comments

Comments
 (0)