Skip to content

Commit c19be9f

Browse files
authored
Merge pull request #66 from motherduckdb/ducklake-improvements
[ducklake] filter out ducklake metadata tables from metadata/fields, add readme
2 parents b40e43c + 546d959 commit c19be9f

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ JOIN (SELECT * from '/Users/you/movies/title.ratings.parquet') y ON x.tconst = y
5959
ORDER BY averageRating * numVotes DESC
6060
```
6161

62+
## Ducklake
63+
64+
Starting from driver version 1.4.1.0, you can configure the DuckDB data source to point to a ducklake database by setting the database file field to `ducklake:/path/to/db_name.ducklake`. This will also create a folder `/path/to/db_name.ducklake.files`, where the parquet files are stored.
65+
66+
Right now, specifying alternative data path for a brand new ducklake database, like `ATTACH 'ducklake:my_other_ducklake.ducklake' AS my_other_ducklake (DATA_PATH 'some/other/path/');` is not natively supported. But you can first initialize the ducklake in SQL, using another duckdb client or within the Metabase SQL interface, with the target data path, then create the data source attaching the ducklake database already initialized with the target data path.
67+
68+
### MotherDuck-hosted Ducklake
69+
If you're using a ducklake database on MotherDuck, it can be attached like a regular MotherDuck database, e.g. `md:my_ducklake_database`.
70+
71+
6272
## Docker
6373

6474
Unfortunately, DuckDB plugin doesn't work in the default Alpine based Metabase docker container out of the box due to some glibc problems. But we provide a Dockerfile to create a Docker image of Metabase based on Debian where the DuckDB plugin does work.

src/metabase/driver/duckdb.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,13 @@
396396
(let
397397
[database_file (get (get database :details) :database_file)
398398
database_file (first (database-file-path-split database_file)) ;; remove additional options in connection string
399-
get_tables_query (str "select * from information_schema.tables "
399+
get_tables_query (str "select * from information_schema.tables where table_catalog not like '__ducklake_metadata%' "
400400
;; Additionally filter by db_name if connecting to MotherDuck, since
401401
;; multiple databases can be attached and information about the
402402
;; non-target database will be present in information_schema.
403403
(if (is_motherduck database_file)
404404
(let [db_name_without_md (motherduck_db_name database_file)]
405-
(format "where table_catalog = '%s' " db_name_without_md))
405+
(format "and table_catalog = '%s' " db_name_without_md))
406406
""))]
407407
{:tables
408408
(sql-jdbc.execute/do-with-connection-with-options
@@ -420,7 +420,7 @@
420420
database_file (first (database-file-path-split database_file)) ;; remove additional options in connection string
421421
get_columns_query (str
422422
(format
423-
"select * from information_schema.columns where table_name = '%s' and table_schema = '%s'"
423+
"select * from information_schema.columns where table_name = '%s' and table_schema = '%s' and table_catalog not like '__ducklake_metadata%%' "
424424
table_name schema)
425425
;; Additionally filter by db_name if connecting to MotherDuck, since
426426
;; multiple databases can be attached and information about the

0 commit comments

Comments
 (0)