Skip to content

Support auto-initializing DuckLake#235

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:ducklake_autoinit
May 30, 2025
Merged

Support auto-initializing DuckLake#235
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:ducklake_autoinit

Conversation

@staticlibs
Copy link
Collaborator

There is a usability gap with using DuckLake with JDBC, when a connection must be opened first and then the following statement must be executed:

ATTACH 'ducklake:...'

Executing this additional ATTACH step, when accessing DuckLake from GUI tools or from high-level engines like Spark, is cumbersome and may require non-trivial configuration.

This change adds two new connection properties:

  1. ducklake: the database-path parameter to pass to ATTACH '<database-path>'.

Value examples:

/path/to/lake1.db
sqlite:/path/to/lake1.db
postgres:postgresql://user:pwd@127.0.0.1:5432/lake1

If ducklake: prefix to the value of this option is not specified - it is added automatically.

Before running the ATTACH it also runs:

INSTALL ducklake
LOAD ducklake
  1. ducklake_alias: the database-alias parameter to pass to ATTACH '<database-path>' AS <database-alias>.

This is to allow to override auto-detected DuckLake catalog name in cases when database-path has long naming or include UUIDs.

After the connection is established it also runs USE <database-alias>.

Testing: test coverage is pending, DuckLake extension is not yet available in the main branch.

There is a usability gap with using DuckLake with JDBC, when a
connection must be opened first and then the following statement must
be executed:

```
ATTACH 'ducklake:...'
```

Executing this additional `ATTACH` step, when accessing DuckLake from
GUI tools or from high-level engines like Spark, is cumbersome and may
require non-trivial configuration.

This change adds two new connection properties:

1. `ducklake`: the `database-path` parameter to pass to
`ATTACH '<database-path>'`.

Value examples:

```
/path/to/lake1.db
sqlite:/path/to/lake1.db
postgres:postgresql://user:pwd@127.0.0.1:5432/lake1
```

If `ducklake:` prefix to the value of this option is not specified - it
is added automatically.

Before running the `ATTACH` it also runs:

```
INSTALL ducklake
LOAD ducklake
```

2. `ducklake_alias`: the `database-alias` parameter to pass to
`ATTACH '<database-path>' AS <database-alias>`.

This is to allow to override auto-detected DuckLake catalog name in
cases when `database-path` has long naming or include UUIDs.

After the connection is established it also runs `USE <database-alias>`.

Testing: test coverage is pending, DuckLake extension is not yet
available in the `main` branch.
@staticlibs staticlibs merged commit 546c388 into duckdb:main May 30, 2025
10 checks passed
@staticlibs staticlibs deleted the ducklake_autoinit branch May 30, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant