Skip to content

Commit ce02764

Browse files
authored
Merge branch 'main' into feat-bigquery-reservations
2 parents 62fd3aa + 3fd4dd9 commit ce02764

File tree

37 files changed

+1290
-89
lines changed

37 files changed

+1290
-89
lines changed

.circleci/continue_config.yml

Lines changed: 8 additions & 4 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
@@ -305,7 +309,7 @@ workflows:
305309
matrix:
306310
parameters:
307311
engine:
308-
- snowflake
312+
#- snowflake
309313
- databricks
310314
- redshift
311315
- bigquery

.github/workflows/pr.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v5
20-
- uses: actions/setup-node@v4
20+
- uses: actions/setup-node@v6
2121
with:
2222
node-version: '22'
2323
- uses: pnpm/action-setup@v4
@@ -32,7 +32,7 @@ jobs:
3232
labels: [ubuntu-2204-8]
3333
steps:
3434
- uses: actions/checkout@v5
35-
- uses: actions/setup-node@v4
35+
- uses: actions/setup-node@v6
3636
with:
3737
node-version: '22'
3838
- uses: pnpm/action-setup@v4
@@ -41,11 +41,11 @@ jobs:
4141
- name: Install dependencies
4242
run: pnpm install
4343
- name: Set up Python
44-
uses: actions/setup-python@v5
44+
uses: actions/setup-python@v6
4545
with:
4646
python-version: '3.12'
4747
- name: Install uv
48-
uses: astral-sh/setup-uv@v6
48+
uses: astral-sh/setup-uv@v7
4949
- name: Install python dependencies
5050
run: |
5151
python -m venv .venv
@@ -62,7 +62,7 @@ jobs:
6262
run: |
6363
source ../../.venv/bin/activate
6464
pnpm run test:e2e
65-
- uses: actions/upload-artifact@v4
65+
- uses: actions/upload-artifact@v5
6666
if: ${{ !cancelled() }}
6767
with:
6868
name: playwright-report
@@ -77,11 +77,11 @@ jobs:
7777
steps:
7878
- uses: actions/checkout@v5
7979
- name: Set up Python
80-
uses: actions/setup-python@v5
80+
uses: actions/setup-python@v6
8181
with:
8282
python-version: '3.10'
8383
- name: Install uv
84-
uses: astral-sh/setup-uv@v6
84+
uses: astral-sh/setup-uv@v7
8585
- name: Install SQLMesh dev dependencies
8686
run: |
8787
uv venv .venv

.github/workflows/private-repo-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
fetch-depth: 0
2323
ref: ${{ github.event.pull_request.head.sha || github.ref }}
2424
- name: Set up Python
25-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@v6
2626
with:
2727
python-version: '3.12'
2828
- name: Install uv
29-
uses: astral-sh/setup-uv@v6
29+
uses: astral-sh/setup-uv@v7
3030
- name: Set up Node.js for UI build
31-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@v6
3232
with:
3333
node-version: '20'
3434
- name: Install pnpm

.github/workflows/release_extension.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fi
2929
echo "Version format is valid: $version"
3030
- name: Setup Node.js
31-
uses: actions/setup-node@v4
31+
uses: actions/setup-node@v6
3232
with:
3333
node-version: '20'
3434
- name: Install pnpm

.github/workflows/release_shared_js.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
fi
3232
echo "Version format is valid: $version"
3333
- name: Setup Node.js
34-
uses: actions/setup-node@v4
34+
uses: actions/setup-node@v6
3535
with:
3636
node-version: '20'
3737
registry-url: 'https://registry.npmjs.org'

docs/guides/model_selection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ Models:
242242
#### Select with git changes
243243

244244
The git-based selector allows you to select models whose files have changed compared to a target branch (default: main). This includes:
245+
245246
- Untracked files (new files not in git)
246-
- Uncommitted changes in working directory
247+
- Uncommitted changes in working directory (both staged and unstaged)
247248
- Committed changes different from the target branch
248249

249250
For example:

docs/integrations/engines/duckdb.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ SQLMesh will place models with the explicit catalog "ephemeral", such as `epheme
8181
data_path: data/ducklake
8282
encrypted: True
8383
data_inlining_row_limit: 10
84+
metadata_schema: main
8485
```
85-
86+
8687
=== "Python"
8788

8889
```python linenums="1"
@@ -106,6 +107,7 @@ SQLMesh will place models with the explicit catalog "ephemeral", such as `epheme
106107
data_path="data/ducklake",
107108
encrypted=True,
108109
data_inlining_row_limit=10,
110+
metadata_schema="main",
109111
),
110112
}
111113
)
@@ -114,6 +116,14 @@ SQLMesh will place models with the explicit catalog "ephemeral", such as `epheme
114116
)
115117
```
116118

119+
**DuckLake Configuration Options:**
120+
121+
- `path`: Path to the DuckLake catalog file
122+
- `data_path`: Path where DuckLake data files are stored
123+
- `encrypted`: Whether to enable encryption for the catalog (default: `False`)
124+
- `data_inlining_row_limit`: Maximum number of rows to inline in the catalog (default: `0`)
125+
- `metadata_schema`: The schema in the catalog server in which to store the DuckLake metadata tables (default: `main`)
126+
117127
#### Other Connection Catalogs Example
118128

119129
Catalogs can also be defined to connect to anything that [DuckDB can be attached to](https://duckdb.org/docs/sql/statements/attach.html).

docs/reference/model_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Configuration options for [`SCD_TYPE_2` models](../concepts/models/model_kinds.m
282282
| `unique_key` | The model column(s) containing each row's unique key | array[str] | Y |
283283
| `valid_from_name` | The model column containing each row's valid from date. (Default: `valid_from`) | str | N |
284284
| `valid_to_name` | The model column containing each row's valid to date. (Default: `valid_to`) | str | N |
285-
| `invalidate_hard_deletes` | If set to true, when a record is missing from the source table it will be marked as invalid - see [here](../concepts/models/model_kinds.md#deletes) for more information. (Default: `True`) | bool | N |
285+
| `invalidate_hard_deletes` | If set to true, when a record is missing from the source table it will be marked as invalid - see [here](../concepts/models/model_kinds.md#deletes) for more information. (Default: `False`) | bool | N |
286286

287287
##### SCD Type 2 By Time
288288

examples/sushi_dbt/models/schema.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ models:
4242
columns:
4343
- name: waiter_id
4444
description: Waiter id
45-
tests:
46-
- not_null
4745
- name: ds
4846
description: Date
4947
- name: waiter_as_customer_by_day

sqlmesh/core/config/connection.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from packaging import version
1818
from sqlglot import exp
1919
from sqlglot.helper import subclasses
20+
from sqlglot.errors import ParseError
2021

2122
from sqlmesh.core import engine_adapter
2223
from sqlmesh.core.config.base import BaseConfig
@@ -238,6 +239,7 @@ class DuckDBAttachOptions(BaseConfig):
238239
data_path: t.Optional[str] = None
239240
encrypted: bool = False
240241
data_inlining_row_limit: t.Optional[int] = None
242+
metadata_schema: t.Optional[str] = None
241243

242244
def to_sql(self, alias: str) -> str:
243245
options = []
@@ -259,6 +261,8 @@ def to_sql(self, alias: str) -> str:
259261
options.append("ENCRYPTED")
260262
if self.data_inlining_row_limit is not None:
261263
options.append(f"DATA_INLINING_ROW_LIMIT {self.data_inlining_row_limit}")
264+
if self.metadata_schema is not None:
265+
options.append(f"METADATA_SCHEMA '{self.metadata_schema}'")
262266

263267
options_sql = f" ({', '.join(options)})" if options else ""
264268
alias_sql = ""
@@ -1889,6 +1893,7 @@ class TrinoConnectionConfig(ConnectionConfig):
18891893

18901894
# SQLMesh options
18911895
schema_location_mapping: t.Optional[dict[re.Pattern, str]] = None
1896+
timestamp_mapping: t.Optional[dict[exp.DataType, exp.DataType]] = None
18921897
concurrent_tasks: int = 4
18931898
register_comments: bool = True
18941899
pre_ping: t.Literal[False] = False
@@ -1913,6 +1918,34 @@ def _validate_regex_keys(
19131918
)
19141919
return compiled
19151920

1921+
@field_validator("timestamp_mapping", mode="before")
1922+
@classmethod
1923+
def _validate_timestamp_mapping(
1924+
cls, value: t.Optional[dict[str, str]]
1925+
) -> t.Optional[dict[exp.DataType, exp.DataType]]:
1926+
if value is None:
1927+
return value
1928+
1929+
result: dict[exp.DataType, exp.DataType] = {}
1930+
for source_type, target_type in value.items():
1931+
try:
1932+
source_datatype = exp.DataType.build(source_type)
1933+
except ParseError:
1934+
raise ConfigError(
1935+
f"Invalid SQL type string in timestamp_mapping: "
1936+
f"'{source_type}' is not a valid SQL data type."
1937+
)
1938+
try:
1939+
target_datatype = exp.DataType.build(target_type)
1940+
except ParseError:
1941+
raise ConfigError(
1942+
f"Invalid SQL type string in timestamp_mapping: "
1943+
f"'{target_type}' is not a valid SQL data type."
1944+
)
1945+
result[source_datatype] = target_datatype
1946+
1947+
return result
1948+
19161949
@model_validator(mode="after")
19171950
def _root_validator(self) -> Self:
19181951
port = self.port
@@ -2015,7 +2048,10 @@ def _static_connection_kwargs(self) -> t.Dict[str, t.Any]:
20152048

20162049
@property
20172050
def _extra_engine_config(self) -> t.Dict[str, t.Any]:
2018-
return {"schema_location_mapping": self.schema_location_mapping}
2051+
return {
2052+
"schema_location_mapping": self.schema_location_mapping,
2053+
"timestamp_mapping": self.timestamp_mapping,
2054+
}
20192055

20202056

20212057
class ClickhouseConnectionConfig(ConnectionConfig):

0 commit comments

Comments
 (0)