Skip to content

Commit 158059b

Browse files
authored
Merge branch 'main' into add_fabric_warehouse
2 parents 6895570 + c6d7309 commit 158059b

165 files changed

Lines changed: 9767 additions & 1476 deletions

File tree

Some content is hidden

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

docs/concepts/models/python_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ def execute(
163163
) -> pd.DataFrame:
164164

165165
# pre-statement
166-
context.fetchdf("SET GLOBAL parameter = 'value';")
166+
context.engine_adapter.execute("SET GLOBAL parameter = 'value';")
167167

168168
# post-statement requires using `yield` instead of `return`
169169
yield pd.DataFrame([
170170
{"id": 1, "name": "name"}
171171
])
172172

173173
# post-statement
174-
context.fetchdf("CREATE INDEX idx ON example.pre_post_statements (id);")
174+
context.engine_adapter.execute("CREATE INDEX idx ON example.pre_post_statements (id);")
175175
```
176176

177177
## Optional on-virtual-update statements

docs/guides/configuration.md

Lines changed: 124 additions & 28 deletions
Large diffs are not rendered by default.

docs/guides/vscode.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ Because the VSCode extension establishes a long-running process connected to the
149149

150150
Therefore, we do not recommend using DuckDB as a state store with the VSCode extension.
151151

152+
### Environment variables
153+
154+
The VSCode extension is based on a [language server](https://en.wikipedia.org/wiki/Language_Server_Protocol) that runs in the background as a separate process. When the VSCode extension starts the background language server, the server inherits environment variables from the environment where you started VSCode. The server does *not* inherit environment variables from your terminal instance in VSCode, so it may not have access to variables you use when calling SQLMesh from the CLI.
155+
156+
If you have environment variables that are needed by the context and the language server, you can use one of these approaches to pass variables to the language server:
157+
158+
- Open VSCode from a terminal that has the variables set
159+
- Use environment variables pulled from somewhere else dynamically (e.g. a `.env` file) in your config
160+
- Set the environment variables in the python environment that the extension uses. You can find detailed instructions [here](https://code.visualstudio.com/docs/python/environments#_environment-variables)
161+
152162
### Python environment woes
153163

154164
The most common problem is the extension not using the correct Python interpreter.

docs/integrations/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SQLMesh supports integrations with the following tools:
99
* [Kestra](https://kestra.io/plugins/plugin-sqlmesh/tasks/cli/io.kestra.plugin.sqlmesh.cli.sqlmeshcli)
1010

1111
## Execution engines
12-
SQLMesh supports the following execution engines for running SQLMesh projects:
12+
SQLMesh supports the following execution engines for running SQLMesh projects (engine `type` in parentheses - example usage: `pip install "sqlmesh[databricks]"`):
1313

1414
* [Athena](./engines/athena.md)
1515
* [Azure SQL](./engines/azuresql.md)
@@ -26,4 +26,4 @@ SQLMesh supports the following execution engines for running SQLMesh projects:
2626
* [Redshift](./engines/redshift.md)
2727
* [Snowflake](./engines/snowflake.md)
2828
* [Spark](./engines/spark.md)
29-
* [Trino](./engines/trino.md)
29+
* [Trino](./engines/trino.md)

docs/quickstart/cli.md

Lines changed: 284 additions & 61 deletions
Large diffs are not rendered by default.
11.2 KB
Loading
7.08 KB
Loading

docs/reference/cli.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,17 @@ Options:
267267
## init
268268

269269
```
270-
Usage: sqlmesh init [OPTIONS] [SQL_DIALECT]
270+
Usage: sqlmesh init [OPTIONS] [ENGINE]
271271
272272
Create a new SQLMesh repository.
273273
274274
Options:
275-
-t, --template TEXT Project template. Supported values: dbt,
276-
dlt, default, empty.
275+
-t, --template TEXT Project template. Supported values: dbt, dlt, default,
276+
empty.
277277
--dlt-pipeline TEXT DLT pipeline for which to generate a SQLMesh project.
278-
For use with dlt template.
278+
Use alongside template: dlt
279+
--dlt-path TEXT The directory where the DLT pipeline resides. Use
280+
alongside template: dlt
279281
--help Show this message and exit.
280282
```
281283

@@ -419,19 +421,31 @@ Usage: sqlmesh render [OPTIONS] MODEL
419421
Render a model's query, optionally expanding referenced models.
420422
421423
Options:
422-
-s, --start TEXT The start datetime of the interval for which this
423-
command will be applied.
424-
-e, --end TEXT The end datetime of the interval for which this
425-
command will be applied.
426-
--execution-time TEXT The execution time (defaults to now).
427-
--expand TEXT Whether or not to expand materialized models
428-
(defaults to False). If True, all referenced models
429-
are expanded as raw queries. Multiple model names can
430-
also be specified, in which case only they will be
431-
expanded as raw queries.
432-
--dialect TEXT The SQL dialect to render the query as.
433-
--no-format Disable fancy formatting of the query.
434-
--help Show this message and exit.
424+
-s, --start TEXT The start datetime of the interval for which
425+
this command will be applied.
426+
-e, --end TEXT The end datetime of the interval for which this
427+
command will be applied.
428+
--execution-time TEXT The execution time (defaults to now).
429+
--expand TEXT Whether or not to expand materialized models
430+
(defaults to False). If True, all referenced
431+
models are expanded as raw queries. Multiple
432+
model names can also be specified, in which case
433+
only they will be expanded as raw queries.
434+
--dialect TEXT The SQL dialect to render the query as.
435+
--no-format Disable fancy formatting of the query.
436+
--max-text-width INTEGER The max number of characters in a segment before
437+
creating new lines in pretty mode.
438+
--leading-comma Determines whether or not the comma is leading
439+
or trailing in select expressions. Default is
440+
trailing.
441+
--normalize-functions TEXT Whether or not to normalize all function names.
442+
Possible values are: 'upper', 'lower'
443+
--indent INTEGER Determines the indentation size in a formatted
444+
string.
445+
--pad INTEGER Determines the pad size in a formatted string.
446+
--normalize Whether or not to normalize identifiers to
447+
lowercase.
448+
--help Show this message and exit.
435449
```
436450

437451
## rewrite

docs/reference/notebook.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import sqlmesh
2929
If desired, you can create the [quickstart example project](../quick_start.md) with the Python `init_example_project` function. The function requires a default SQL dialect for the project's models; this example uses `snowflake`:
3030

3131
```python
32-
from sqlmesh.cli.example_project import init_example_project
32+
from sqlmesh.cli.project_init import init_example_project
3333

34-
init_example_project("path_to_project_directory", dialect="snowflake")
34+
init_example_project("path_to_project_directory", engine_type="snowflake")
3535
```
3636

3737
Alternatively, create the project with a notebook magic:
@@ -201,6 +201,9 @@ options:
201201
```
202202
%render [--start START] [--end END] [--execution-time EXECUTION_TIME]
203203
[--expand EXPAND] [--dialect DIALECT] [--no-format]
204+
[--normalize] [--pad PAD] [--indent INDENT]
205+
[--normalize-functions NORMALIZE_FUNCTIONS] [--leading-comma]
206+
[--max-text-width MAX_TEXT_WIDTH]
204207
model
205208
206209
Renders a model's query, optionally expanding referenced models.
@@ -220,6 +223,17 @@ options:
220223
models are expanded as raw queries.
221224
--dialect DIALECT SQL dialect to render.
222225
--no-format Disable fancy formatting of the query.
226+
--normalize Whether or not to normalize identifiers to lowercase.
227+
--pad PAD Determines the pad size in a formatted string.
228+
--indent INDENT Determines the indentation size in a formatted string.
229+
--normalize-functions NORMALIZE_FUNCTIONS
230+
Whether or not to normalize all function names.
231+
Possible values are: 'upper', 'lower'
232+
--leading-comma Determines whether or not the comma is leading or
233+
trailing in select expressions. Default is trailing.
234+
--max-text-width MAX_TEXT_WIDTH
235+
The max number of characters in a segment before
236+
creating new lines in pretty mode.
223237
```
224238

225239
#### dag

examples/sushi/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,17 @@
128128
)
129129

130130

131-
environment_suffix_config = Config(
131+
environment_suffix_table_config = Config(
132132
default_connection=DuckDBConnectionConfig(),
133133
model_defaults=model_defaults,
134134
environment_suffix_target=EnvironmentSuffixTarget.TABLE,
135135
)
136136

137+
environment_suffix_catalog_config = environment_suffix_table_config.model_copy(
138+
update={
139+
"environment_suffix_target": EnvironmentSuffixTarget.CATALOG,
140+
}
141+
)
137142

138143
CATALOGS = {
139144
"in_memory": ":memory:",

0 commit comments

Comments
 (0)