Skip to content

Commit 51a87cd

Browse files
authored
Merge branch 'main' into add_fabric_warehouse
2 parents 5cc30ab + b256ba5 commit 51a87cd

File tree

173 files changed

+10127
-1684
lines changed

Some content is hidden

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

173 files changed

+10127
-1684
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ python -m venv .venv
145145
source .venv/bin/activate
146146
pip install 'sqlmesh[lsp]' # install the sqlmesh package with extensions to work with VSCode
147147
source .venv/bin/activate # reactivate the venv to ensure you're using the right installation
148-
sqlmesh init duckdb # get started right away with a local duckdb instance
149-
sqlmesh plan # see the plan for the changes you're making
148+
sqlmesh init # follow the prompts to get started (choose DuckDB)
150149
```
151150

152151
</details>
@@ -163,13 +162,12 @@ python -m venv .venv
163162
.\.venv\Scripts\Activate.ps1
164163
pip install 'sqlmesh[lsp]' # install the sqlmesh package with extensions to work with VSCode
165164
.\.venv\Scripts\Activate.ps1 # reactivate the venv to ensure you're using the right installation
166-
sqlmesh init duckdb # get started right away with a local duckdb instance
167-
sqlmesh plan # see the plan for the changes you're making
165+
sqlmesh init # follow the prompts to get started (choose DuckDB)
168166
```
169167
</details>
170168

171169

172-
Follow the [quickstart guide](https://sqlmesh.readthedocs.io/en/stable/quickstart/cli/#1-create-the-sqlmesh-project) to learn how to use SQLMesh. You already have a head start!
170+
Follow the [quickstart guide](https://sqlmesh.readthedocs.io/en/stable/quickstart/cli/) to learn how to use SQLMesh. You already have a head start!
173171

174172
Follow the [crash course](https://sqlmesh.readthedocs.io/en/stable/examples/sqlmesh_cli_crash_course/) to learn the core movesets and use the easy to reference cheat sheet.
175173

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/engines/duckdb.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| `extensions` | Extension to load into duckdb. Only autoloadable extensions are supported. | list | N |
1919
| `connector_config` | Configuration to pass into the duckdb connector. | dict | N |
2020
| `secrets` | Configuration for authenticating external sources (e.g., S3) using DuckDB secrets. | dict | N |
21+
| `filesystems` | Configuration for registering `fsspec` filesystems to the DuckDB connection. | dict | N |
2122

2223
#### DuckDB Catalogs Example
2324

@@ -256,4 +257,36 @@ After configuring the secrets, you can directly reference S3 paths in your catal
256257

257258
Refer to the official DuckDB documentation for the full list of [supported S3 secret parameters](https://duckdb.org/docs/stable/extensions/httpfs/s3api.html#overview-of-s3-secret-parameters) and for more information on the [Secrets Manager configuration](https://duckdb.org/docs/configuration/secrets_manager.html).
258259

259-
> Note: Loading credentials at runtime using `load_aws_credentials()` or similar deprecated functions may fail when using SQLMesh.
260+
> Note: Loading credentials at runtime using `load_aws_credentials()` or similar deprecated functions may fail when using SQLMesh.
261+
262+
##### File system configuration example for Microsoft Onelake
263+
264+
The `filesystems` accepts a list of file systems to register in the DuckDB connection. This is especially useful for Azure Storage Accounts, as it adds write support for DuckDB which is not natively supported by DuckDB (yet).
265+
266+
267+
=== "YAML"
268+
269+
```yaml linenums="1"
270+
gateways:
271+
ducklake:
272+
connection:
273+
type: duckdb
274+
catalogs:
275+
ducklake:
276+
type: ducklake
277+
path: myducklakecatalog.duckdb
278+
data_path: abfs://MyFabricWorkspace/MyFabricLakehouse.Lakehouse/Files/DuckLake.Files
279+
extensions:
280+
- ducklake
281+
filesystems:
282+
- fs: abfs
283+
account_name: onelake
284+
account_host: onelake.blob.fabric.microsoft.com
285+
client_id: {{ env_var('AZURE_CLIENT_ID') }}
286+
client_secret: {{ env_var('AZURE_CLIENT_SECRET') }}
287+
tenant_id: {{ env_var('AZURE_TENANT_ID') }}
288+
# anon: False # To use azure.identity.DefaultAzureCredential authentication
289+
```
290+
291+
292+
Refer to the documentation for `fsspec` [fsspec.filesystem](https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.filesystem) and `adlfs` [adlfs.AzureBlobFileSystem](https://fsspec.github.io/adlfs/api/#api-reference) for a full list of storage options.

docs/integrations/overview.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ 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

14-
* [Athena](./engines/athena.md)
15-
* [Azure SQL](./engines/azuresql.md)
16-
* [BigQuery](./engines/bigquery.md)
17-
* [ClickHouse](./engines/clickhouse.md)
18-
* [Databricks](./engines/databricks.md)
19-
* [DuckDB](./engines/duckdb.md)
20-
* [Fabric](./engines/fabric.md)
21-
* [MotherDuck](./engines/motherduck.md)
22-
* [MSSQL](./engines/mssql.md)
23-
* [MySQL](./engines/mysql.md)
24-
* [Postgres](./engines/postgres.md)
25-
* [GCP Postgres](./engines/gcp-postgres.md)
26-
* [Redshift](./engines/redshift.md)
27-
* [Snowflake](./engines/snowflake.md)
28-
* [Spark](./engines/spark.md)
29-
* [Trino](./engines/trino.md)
14+
* [Athena](./engines/athena.md) (athena)
15+
* [Azure SQL](./engines/azuresql.md) (azuresql)
16+
* [BigQuery](./engines/bigquery.md) (bigquery)
17+
* [ClickHouse](./engines/clickhouse.md) (clickhouse)
18+
* [Databricks](./engines/databricks.md) (databricks)
19+
* [DuckDB](./engines/duckdb.md) (duckdb)
20+
* [Fabric](./engines/fabric.md) (fabric)
21+
* [MotherDuck](./engines/motherduck.md) (motherduck)
22+
* [MSSQL](./engines/mssql.md) (mssql)
23+
* [MySQL](./engines/mysql.md) (mysql)
24+
* [Postgres](./engines/postgres.md) (postgres)
25+
* [GCP Postgres](./engines/gcp-postgres.md) (gcppostgres)
26+
* [Redshift](./engines/redshift.md) (redshift)
27+
* [Snowflake](./engines/snowflake.md) (snowflake)
28+
* [Spark](./engines/spark.md) (spark)
29+
* [Trino](./engines/trino.md) (trino)

0 commit comments

Comments
 (0)