Skip to content

Commit 9de84c1

Browse files
authored
Merge branch 'main' into fix_project_name_change_error
2 parents 698d8f7 + d5ceeb2 commit 9de84c1

File tree

865 files changed

+83091
-43067
lines changed

Some content is hidden

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

865 files changed

+83091
-43067
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ on_main_or_tag_filter: &on_main_or_tag_filter
77
branches:
88
only: main
99
tags:
10-
only: /^v.+/
10+
only: /^v\d+\.\d+\.\d+/
1111

1212
on_tag_filter: &on_tag_filter
1313
filters:
1414
branches:
1515
ignore: /.*/
1616
tags:
17-
only: /^v.+/
17+
only: /^v\d+\.\d+\.\d+/
1818

1919
orbs:
2020
path-filtering: circleci/path-filtering@1.2.0
@@ -39,7 +39,7 @@ jobs:
3939
command: unset TWINE_USERNAME TWINE_PASSWORD && make publish-tests
4040
gh-release:
4141
docker:
42-
- image: cimg/node:16.14
42+
- image: cimg/node:20.19.0
4343
resource_class: small
4444
steps:
4545
- run:
@@ -54,7 +54,7 @@ jobs:
5454
5555
ui-build:
5656
docker:
57-
- image: cimg/node:19.8
57+
- image: cimg/node:20.19.0
5858
resource_class: medium
5959
steps:
6060
- checkout

.circleci/continue_config.yml

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@ jobs:
9393
- run:
9494
name: Run linters and code style checks
9595
command: make py-style
96-
- run:
97-
name: Exercise the benchmarks
98-
command: make benchmark-ci
96+
- unless:
97+
condition:
98+
equal: ["3.9", << parameters.python_version >>]
99+
steps:
100+
- run:
101+
name: Exercise the benchmarks
102+
command: make benchmark-ci
99103
- run:
100104
name: Run cicd tests
101105
command: make cicd-test
@@ -144,8 +148,11 @@ jobs:
144148
- halt_unless_core
145149
- checkout
146150
- run:
147-
name: Run the migration test
148-
command: ./.circleci/test_migration.sh
151+
name: Run the migration test - sushi
152+
command: ./.circleci/test_migration.sh sushi "--gateway duckdb_persistent"
153+
- run:
154+
name: Run the migration test - sushi_dbt
155+
command: ./.circleci/test_migration.sh sushi_dbt "--config migration_test_config"
149156

150157
ui_style:
151158
docker:
@@ -172,7 +179,7 @@ jobs:
172179

173180
ui_test:
174181
docker:
175-
- image: mcr.microsoft.com/playwright:v1.52.0-jammy
182+
- image: mcr.microsoft.com/playwright:v1.54.1-jammy
176183
resource_class: medium
177184
steps:
178185
- halt_unless_client
@@ -201,39 +208,6 @@ jobs:
201208
name: Run tests
202209
command: npm --prefix web/client run test
203210

204-
trigger_private_tests:
205-
docker:
206-
- image: cimg/python:3.12.0
207-
resource_class: small
208-
steps:
209-
- checkout
210-
- run:
211-
name: Install setuptools scm
212-
command: pip install setuptools_scm
213-
- run:
214-
name: Trigger private tests
215-
command: |
216-
export COMMIT_MESSAGE="$(git log --format=%s -n 1 $CIRCLE_SHA1)"
217-
export FORMATTED_COMMIT_MESSAGE="${COMMIT_MESSAGE//\"/\\\"}"
218-
# returns a version string like 0.1.0.dev11
219-
export PACKAGE_VERSION="$(python ./.circleci/get_scm_version.py)"
220-
curl --request POST \
221-
--url $TOBIKO_PRIVATE_CIRCLECI_URL \
222-
--header "Circle-Token: $TOBIKO_PRIVATE_CIRCLECI_KEY" \
223-
--header "content-type: application/json" \
224-
--data '{
225-
"branch":"main",
226-
"parameters":{
227-
"run_main_pr":false,
228-
"run_sqlmesh_commit":true,
229-
"sqlmesh_branch":"'$CIRCLE_BRANCH'",
230-
"sqlmesh_commit_author":"'$CIRCLE_USERNAME'",
231-
"sqlmesh_commit_hash":"'$CIRCLE_SHA1'",
232-
"sqlmesh_commit_message":"'"$FORMATTED_COMMIT_MESSAGE"'",
233-
"sqlmesh_package_version":"'$PACKAGE_VERSION'"
234-
}
235-
}'
236-
237211
engine_tests_docker:
238212
parameters:
239213
engine:
@@ -270,6 +244,9 @@ jobs:
270244
steps:
271245
- halt_unless_core
272246
- checkout
247+
- run:
248+
name: Install OS-level dependencies
249+
command: ./.circleci/install-prerequisites.sh "<< parameters.engine >>"
273250
- run:
274251
name: Generate database name
275252
command: |
@@ -279,6 +256,12 @@ jobs:
279256
echo "export SNOWFLAKE_DATABASE='$TEST_DB_NAME'" >> "$BASH_ENV"
280257
echo "export DATABRICKS_CATALOG='$TEST_DB_NAME'" >> "$BASH_ENV"
281258
echo "export REDSHIFT_DATABASE='$TEST_DB_NAME'" >> "$BASH_ENV"
259+
echo "export GCP_POSTGRES_DATABASE='$TEST_DB_NAME'" >> "$BASH_ENV"
260+
echo "export FABRIC_DATABASE='$TEST_DB_NAME'" >> "$BASH_ENV"
261+
262+
# Make snowflake private key available
263+
echo $SNOWFLAKE_PRIVATE_KEY_RAW | base64 -d > /tmp/snowflake-keyfile.p8
264+
echo "export SNOWFLAKE_PRIVATE_KEY_FILE='/tmp/snowflake-keyfile.p8'" >> "$BASH_ENV"
282265
- run:
283266
name: Create test database
284267
command: ./.circleci/manage-test-db.sh << parameters.engine >> "$TEST_DB_NAME" up
@@ -306,6 +289,7 @@ workflows:
306289
- "3.10"
307290
- "3.11"
308291
- "3.12"
292+
- "3.13"
309293
- cicd_tests_windows
310294
- engine_tests_docker:
311295
name: engine_<< matrix.engine >>
@@ -335,13 +319,8 @@ workflows:
335319
- bigquery
336320
- clickhouse-cloud
337321
- athena
338-
filters:
339-
branches:
340-
only:
341-
- main
342-
- trigger_private_tests:
343-
requires:
344-
- style_and_cicd_tests
322+
- fabric
323+
- gcp-postgres
345324
filters:
346325
branches:
347326
only:

.circleci/install-prerequisites.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,31 @@ fi
1212

1313
ENGINE="$1"
1414

15-
COMMON_DEPENDENCIES="libpq-dev netcat-traditional"
15+
COMMON_DEPENDENCIES="libpq-dev netcat-traditional unixodbc-dev"
1616
ENGINE_DEPENDENCIES=""
1717

1818
if [ "$ENGINE" == "spark" ]; then
1919
ENGINE_DEPENDENCIES="default-jdk"
20+
elif [ "$ENGINE" == "fabric" ]; then
21+
echo "Installing Microsoft package repository"
22+
23+
# ref: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
24+
curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb
25+
sudo dpkg -i packages-microsoft-prod.deb
26+
rm packages-microsoft-prod.deb
27+
28+
ENGINE_DEPENDENCIES="msodbcsql18"
2029
fi
2130

2231
ALL_DEPENDENCIES="$COMMON_DEPENDENCIES $ENGINE_DEPENDENCIES"
2332

2433
echo "Installing OS-level dependencies: $ALL_DEPENDENCIES"
2534

26-
sudo apt-get clean && sudo apt-get -y update && sudo apt-get -y install $ALL_DEPENDENCIES
35+
sudo apt-get clean && sudo apt-get -y update && sudo ACCEPT_EULA='Y' apt-get -y install $ALL_DEPENDENCIES
36+
37+
if [ "$ENGINE" == "spark" ]; then
38+
echo "Using Java version for spark:"
39+
java -version
40+
fi
2741

2842
echo "All done"

.circleci/manage-test-db.sh

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function_exists() {
2525
# Snowflake
2626
snowflake_init() {
2727
echo "Installing Snowflake CLI"
28-
pip install "snowflake-cli-labs<3.8.0"
28+
pip install "snowflake-cli"
2929
}
3030

3131
snowflake_up() {
@@ -40,18 +40,6 @@ snowflake_down() {
4040
databricks_init() {
4141
echo "Installing Databricks CLI"
4242
curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sudo sh || true
43-
44-
echo "Writing out Databricks CLI config file"
45-
echo -e "[DEFAULT]\nhost = $DATABRICKS_SERVER_HOSTNAME\ntoken = $DATABRICKS_ACCESS_TOKEN" > ~/.databrickscfg
46-
47-
# this takes a path like 'sql/protocolv1/o/2934659247569/0723-005339-foobar' and extracts '0723-005339-foobar' from it
48-
CLUSTER_ID=${DATABRICKS_HTTP_PATH##*/}
49-
50-
echo "Extracted cluster id: $CLUSTER_ID from '$DATABRICKS_HTTP_PATH'"
51-
52-
# Note: the cluster doesnt need to be running to create / drop catalogs, but it does need to be running to run the integration tests
53-
echo "Ensuring cluster is running"
54-
databricks clusters start $CLUSTER_ID || true
5543
}
5644

5745
databricks_up() {
@@ -80,7 +68,11 @@ redshift_down() {
8068
EXIT_CODE=1
8169
ATTEMPTS=0
8270
while [ $EXIT_CODE -ne 0 ] && [ $ATTEMPTS -lt 5 ]; do
83-
redshift_exec "select pg_terminate_backend(procpid) from pg_stat_activity where datname = '$1'"
71+
# note: sometimes this pg_terminate_backend() call can randomly fail with: ERROR: Insufficient privileges
72+
# if it does, let's proceed with the drop anyway rather than aborting and never attempting the drop
73+
redshift_exec "select pg_terminate_backend(procpid) from pg_stat_activity where datname = '$1'" || true
74+
75+
# perform drop
8476
redshift_exec "drop database $1;" && EXIT_CODE=$? || EXIT_CODE=$?
8577
if [ $EXIT_CODE -ne 0 ]; then
8678
echo "Unable to drop database; retrying..."
@@ -109,6 +101,51 @@ clickhouse-cloud_init() {
109101
echo "Clickhouse Cloud instance $CLICKHOUSE_CLOUD_HOST is up and running"
110102
}
111103

104+
# GCP Postgres
105+
gcp-postgres_init() {
106+
# Download and start Cloud SQL Proxy
107+
curl -fsSL -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.18.0/cloud-sql-proxy.linux.amd64
108+
chmod +x cloud-sql-proxy
109+
echo "$GCP_POSTGRES_KEYFILE_JSON" > /tmp/keyfile.json
110+
./cloud-sql-proxy --credentials-file /tmp/keyfile.json $GCP_POSTGRES_INSTANCE_CONNECTION_STRING &
111+
112+
# Wait for proxy to start
113+
sleep 5
114+
}
115+
116+
gcp-postgres_exec() {
117+
PGPASSWORD=$GCP_POSTGRES_PASSWORD psql -h 127.0.0.1 -U $GCP_POSTGRES_USER -c "$1" postgres
118+
}
119+
120+
gcp-postgres_up() {
121+
gcp-postgres_exec "create database $1"
122+
}
123+
124+
gcp-postgres_down() {
125+
gcp-postgres_exec "drop database $1"
126+
}
127+
128+
# Fabric
129+
fabric_init() {
130+
python --version #note: as at 2025-08-20, ms-fabric-cli is pinned to Python >= 3.10, <3.13
131+
pip install ms-fabric-cli
132+
133+
# to prevent the '[EncryptionFailed] An error occurred with the encrypted cache.' error
134+
# ref: https://microsoft.github.io/fabric-cli/#switch-to-interactive-mode-optional
135+
fab config set encryption_fallback_enabled true
136+
137+
echo "Logging in to Fabric"
138+
fab auth login -u $FABRIC_CLIENT_ID -p $FABRIC_CLIENT_SECRET --tenant $FABRIC_TENANT_ID
139+
}
140+
141+
fabric_up() {
142+
fab create "SQLMesh CircleCI.Workspace/$1.Warehouse"
143+
}
144+
145+
fabric_down() {
146+
fab rm -f "SQLMesh CircleCI.Workspace/$1.Warehouse" || true
147+
}
148+
112149
INIT_FUNC="${ENGINE}_init"
113150
UP_FUNC="${ENGINE}_up"
114151
DOWN_FUNC="${ENGINE}_down"

.circleci/test_migration.sh

Lines changed: 28 additions & 13 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,48 @@ else
149
LAST_TAG=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
1510
fi
1611

12+
if [ "$1" == "" ]; then
13+
echo "Usage: $0 <example name> <sqlmesh opts>"
14+
echo "eg $0 sushi '--gateway duckdb_persistent'"
15+
exit 1
16+
fi
17+
18+
19+
TMP_DIR=$(mktemp -d)
20+
EXAMPLE_NAME="$1"
21+
SQLMESH_OPTS="$2"
22+
EXAMPLE_DIR="./examples/$EXAMPLE_NAME"
23+
TEST_DIR="$TMP_DIR/$EXAMPLE_NAME"
24+
25+
echo "Running migration test for '$EXAMPLE_NAME' in '$TEST_DIR' for example project '$EXAMPLE_DIR' using options '$SQLMESH_OPTS'"
26+
1727
git checkout $LAST_TAG
1828

1929
# Install dependencies from the previous release.
2030
make install-dev
2131

22-
cp -r ./examples/sushi $TMP_DIR
32+
cp -r $EXAMPLE_DIR $TEST_DIR
33+
34+
# this is only needed temporarily until the released tag for $LAST_TAG includes this config
35+
if [ "$EXAMPLE_NAME" == "sushi_dbt" ]; then
36+
echo 'migration_test_config = sqlmesh_config(Path(__file__).parent, dbt_target_name="duckdb")' >> $TEST_DIR/config.py
37+
fi
2338

2439
# Run initial plan
25-
pushd $SUSHI_DIR
40+
pushd $TEST_DIR
2641
rm -rf ./data/*
27-
sqlmesh --gateway $GATEWAY_NAME plan --no-prompts --auto-apply
42+
sqlmesh $SQLMESH_OPTS plan --no-prompts --auto-apply
2843
rm -rf .cache
2944
popd
3045

31-
# Switch back to the starting state of the repository
46+
# Switch back to the starting state of the repository
3247
git checkout -
3348

3449
# Install updated dependencies.
3550
make install-dev
3651

3752
# 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+
pushd $TEST_DIR
54+
sqlmesh $SQLMESH_OPTS migrate
55+
sqlmesh $SQLMESH_OPTS diff prod
56+
popd

0 commit comments

Comments
 (0)