Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from gouline/read-only-connection
Browse files Browse the repository at this point in the history
Read only connection
  • Loading branch information
AlexR2D2 authored Feb 8, 2023
2 parents 66d4665 + d175c90 commit ee885c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ driver:
display-name: Database file
placeholder: /home/you/the.duckdb (or empty for 'in memory' mode)
required: false
- name: read_only
display-name: Establish a read-only connection
default: false
type: boolean
init:
- step: load-namespace
namespace: metabase.driver.duckdb
Expand Down
11 changes: 6 additions & 5 deletions src/metabase/driver/duckdb.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
(driver/register! :duckdb, :parent :sql-jdbc)

(defmethod sql-jdbc.conn/connection-details->spec :duckdb
[_ {:keys [database_file], :as details}]
[_ {:keys [database_file, read_only], :as details}]
(let [conn_details (merge
{:classname "org.duckdb.DuckDBDriver"
:subprotocol "duckdb"
:subname (or database_file "")}
(dissoc details :database_file :port :engine))]
{:classname "org.duckdb.DuckDBDriver"
:subprotocol "duckdb"
:subname (or database_file "")
"duckdb.read_only" (str read_only)}
(dissoc details :database_file :read_only :port :engine))]
conn_details))

(def ^:private database-type->base-type
Expand Down

0 comments on commit ee885c5

Please sign in to comment.