--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: mssql_ducklake excerpt: | DuckDB Community Extensions DuckLake with its catalog in Microsoft SQL Server or Azure SQL - embedded DuckLake, native TDS through the mssql extension. extension: name: mssql_ducklake description: "DuckLake with its catalog in Microsoft SQL Server or Azure SQL - embedded DuckLake, native TDS through the mssql extension." version: "0.2.0" language: "C++" build: "cmake" licence: "MIT" maintainers: - "VGSML" # the same set as mssql's: the manager is nothing without the mssql extension at runtime, and # there is no mssql on these platforms (no wasm at all - raw TDS sockets) excluded_platforms: - "osx_amd64" - "windows_arm64" - "wasm_mvp" - "wasm_eh" - "wasm_threads" test_config: '{"test_env_variables": {"SKIP_TESTS": "1"}}' repo: github: "hugr-lab/mssql-ducklake" # DuckDB 2.0: v0.2.0 (the commit tag v0.2.0 points at). A SHA rather than a tag name. ref: "d4d7a40beafda896ada610faf0bd64bf5db642e8" # DuckDB 1.5.6: v0.1.2, the commit ref used to point at. variegata: "93a676d05098a6fc1289070adfbfcd96ee8c6dfc" docs: hello_world: | INSTALL mssql FROM community; INSTALL mssql_ducklake FROM community; LOAD mssql_ducklake; ATTACH 'ducklake:mssql:Server=localhost,1433;Database=lake_meta;User Id=sa;Password=...;TrustServerCertificate=yes' AS lake (DATA_PATH 's3://bucket/lake/'); CREATE TABLE lake.t AS SELECT range AS i FROM range(100); SELECT count(*) FROM lake.t; extended_description: | Runs [DuckLake](https://ducklake.select) with its **catalog in Microsoft SQL Server or Azure SQL**. The extension embeds the complete, unmodified DuckLake source at a pinned commit (catalog format 1.1 on DuckDB 2.0) and adds a SQL Server metadata manager beside DuckLake's built-in PostgreSQL and SQLite ones; it talks to the server through the mssql extension (native TDS, no ODBC), which must be installed too. Everything DuckLake does - snapshots, time travel, schema evolution, data inlining, partitioning, the maintenance functions, `ducklake:postgres:` catalogs as well - works as in the stock extension; the data files live wherever DuckLake puts them. Documentation: https://hugr-lab.com/docs/mssql-ducklake/ **Mutually exclusive with the stock `ducklake` extension**: both provide the same functions and the same `ducklake:` attach prefix - load one or the other, and load `mssql_ducklake` before the first `ATTACH 'ducklake:...'`. Needs the mssql extension (v0.3.0 or newer on DuckDB 2.0, v0.2.5 or newer on 1.5.6), and a SQL Server 2019+ or Azure SQL database (a UTF-8 collation). Experimental. The catalog is shaped for SQL Server on creation (primary keys, UTF-8 binary collation, indexes, forced parameterization), a commit goes to the server as one T-SQL batch, and the catalog loads in one statement and is kept per ATTACH. On equal Azure VMs the 500-table benchmark takes 0.63x of the PostgreSQL backend's time; what is not there yet is on the limitations page. extension_star_count: 13 extension_star_count_pretty: 13 extension_download_count: 886 extension_download_count_pretty: 886 image: '/images/community_extensions/social_preview/preview_community_extension_mssql_ducklake.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Linux ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | macOS AMD64 | ❌ | ❌ | ✅ | ✅ | ❌ | | macOS ARM64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows AMD64 | ❌ | ❌ | ✅ | ✅ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ✅ | ✅ | ✅ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions | function_name | function_type | description | comment | examples | |----------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ducklake_add_data_files | table | NULL | NULL | | | ducklake_cleanup_old_files | table | NULL | NULL | | | ducklake_commit | table | NULL | NULL | | | ducklake_current_snapshot | table | NULL | NULL | | | ducklake_delete_orphaned_files | table | NULL | NULL | | | ducklake_expire_snapshots | table | NULL | NULL | | | ducklake_flush_inlined_data | table | NULL | NULL | | | ducklake_last_committed_snapshot | table | NULL | NULL | | | ducklake_list_files | table | NULL | NULL | | | ducklake_merge_adjacent_files | table | NULL | NULL | | | ducklake_options | table | NULL | NULL | | | ducklake_rewrite_data_files | table | NULL | NULL | | | ducklake_scan | table | NULL | NULL | | | ducklake_set_commit_message | table | NULL | NULL | | | ducklake_set_option | table | NULL | NULL | | | ducklake_settings | table | NULL | NULL | | | ducklake_snapshots | table | NULL | NULL | | | ducklake_table_changes | table_macro | NULL | NULL | | | ducklake_table_deletions | table | NULL | NULL | | | ducklake_table_info | table | NULL | NULL | | | ducklake_table_insertions | table | NULL | NULL | | | mssql_azure_auth_test | scalar | Acquires an Azure AD access token with the named azure secret, without connecting to SQL Server, and returns the token abbreviated to its first and last characters and its length, or the error. tenant overrides the secret's tenant for interactive (device code) authentication. | NULL | [mssql_azure_auth_test('my_azure_secret')] | | mssql_catalog_scan | table | Internal: the scan behind an attached SQL Server table. Registered so DuckDB can copy a plan that holds one; read a table by name instead. | NULL | [SELECT * FROM db.dbo.orders] | | mssql_dml | table | Internal: the vehicle a pushed UPDATE / DELETE / INSERT ... SELECT / MERGE runs through (spec 080). Runs the T-SQL statement once on the attached database -- atomically in autocommit, on the transaction's connection inside one -- and returns its row count as Count. The remote-pushdown rewriter's target, not an API: its arguments carry no compatibility promise. | NULL | [SELECT * FROM mssql_dml('db', 'UPDATE [dbo].[t] SET [v] = 1 WHERE [id] = @p1', {'p1': 5}, '@p1 int', kind := 'update', target_schema := 'dbo', target_table := 't')] | | mssql_ducklake_catalog_info | table | NULL | NULL | | | mssql_ducklake_trace | scalar | NULL | NULL | | | mssql_ducklake_trace_mark | scalar | NULL | NULL | | | mssql_ducklake_version | scalar | NULL | NULL | | | mssql_exec | scalar | Runs a T-SQL statement or batch on an attached SQL Server database and returns the number of rows it affected. | NULL | [mssql_exec('db', 'CREATE TABLE dbo.notes (id int PRIMARY KEY, body nvarchar(200))')] | | mssql_exec_params | scalar | Runs a parameterised T-SQL statement once per row and returns the rows affected: each field of the params STRUCT becomes an @-parameter of an sp_executesql call, declared from its DuckDB type or by the optional declarations list, so the server compiles the statement once. | NULL | [mssql_exec_params('db', 'INSERT INTO dbo.notes (id, body) VALUES (@id, @body)', {'id': 1, 'body': 'hello'})] | | mssql_invalidate_cache | scalar | Marks cached metadata of an attached SQL Server database as stale -- the whole catalog, one schema, or one table -- so it is reloaded from the server on next use; everything else keeps its cache. | NULL | [mssql_invalidate_cache('db', 'dbo', 'orders')] | | mssql_kerberos_auth_test | scalar | Builds the Kerberos (GSSAPI) token for the SQL Server at host and port (default 1433) without connecting to it, and returns the principal, SPN and token size, or the GSSAPI error. | NULL | [mssql_kerberos_auth_test('sql.example.com', 1433)] | | mssql_kerberos_auth_test_secret | scalar | mssql_kerberos_auth_test driven by the named MSSQL secret: host, port and the Kerberos options (krb5.conf, keytab, credential cache, realm, SPN override) are read from it, as ATTACH would read them. | NULL | [mssql_kerberos_auth_test_secret('my_mssql_secret')] | | mssql_pool_stats | table | Returns connection pool statistics -- total, idle, active and pinned connections, acquire counts and timeouts, creation failures and the last creation error -- for every attached SQL Server database, or for the one named. | NULL | [SELECT * FROM mssql_pool_stats(), SELECT * FROM mssql_pool_stats('db')] | | mssql_preload_catalog | scalar | Loads the metadata of every schema, table and column of an attached SQL Server database in bulk -- or of one schema, given as a second argument -- and returns a summary of what it loaded. | NULL | [mssql_preload_catalog('db'), mssql_preload_catalog('db', 'dbo')] | | mssql_refresh_cache | scalar | Reloads the whole metadata cache -- schemas, tables, columns -- of an attached SQL Server database from the server, now. | NULL | [mssql_refresh_cache('db')] | | mssql_scan | table | Runs a T-SQL query on an attached SQL Server database and returns its result set. The shape is described at bind time without running the query; prepared := true compiles it once with sp_prepare instead. | NULL | [SELECT * FROM mssql_scan('db', 'SELECT TOP 10 name, create_date FROM sys.tables')] | | mssql_scan_params | table | mssql_scan with parameters: each field of the STRUCT becomes an @-parameter of an sp_executesql call, declared from its DuckDB type or by the optional declarations list, so one server plan serves every call. | NULL | [SELECT * FROM mssql_scan_params('db', 'SELECT name FROM sys.objects WHERE object_id > @id', {'id': 100}), SELECT * FROM mssql_scan_params('db', 'SELECT name FROM sys.objects WHERE create_date > @since', {'since': TIMESTAMP '2024-01-01'}, '@since datetime')] | | mssql_scan_params_unsafe | table | mssql_scan_params with the result's shape given instead of described (columns := {'name': 'TYPE', ...}): nothing is asked of the server at bind, and the rows are checked against the shape when the statement runs. | NULL | [SELECT * FROM mssql_scan_params_unsafe('db', 'SELECT name FROM sys.objects WHERE object_id > @id', {'id': 100}, columns := {'name': 'VARCHAR'})] | | mssql_scan_unsafe | table | mssql_scan with the result's shape given instead of described: columns := {'name': 'TYPE', ...} is returned at bind without asking the server (no connection, no describe), and the rows are checked against it when the query runs. The caller vouches for the shape; a stream that does not fit it fails. Types are read as by the catalog: tinyint UTINYINT, datetime2(7) TIMESTAMP_NS, a GEOMETRY column must arrive as WKB (STAsBinary()). | NULL | [SELECT * FROM mssql_scan_unsafe('db', 'SELECT object_id, name FROM sys.objects', columns := {'object_id': 'INTEGER', 'name': 'VARCHAR'})] | | mssql_version | scalar | Returns the version of the mssql extension. | NULL | [mssql_version()] | | mssql_winsspi_auth_test | scalar | Windows peer of mssql_kerberos_auth_test: builds the SSPI (Negotiate) token for the SQL Server at host and port (default 1433) without connecting to it, and returns the principal, SPN and token size, or the SSPI error. | NULL | [mssql_winsspi_auth_test('sql.example.com', 1433)] | | mssql_winsspi_auth_test_spn | scalar | mssql_winsspi_auth_test for an explicit service principal name instead of the MSSQLSvc/