Skip to content
Snippets Groups Projects
Unverified Commit bf13813e authored by Tim Macdonald's avatar Tim Macdonald Committed by GitHub
Browse files

Remove obsolete CLI flags for `export`; fix collection specification (#33189)

* Remove obsolete CLI flags for `export`; fix collection specification

[Fixes #33168]

* Allow comma-separated IDs
parent 8148254d
No related branches found
No related tags found
No related merge requests found
......@@ -203,15 +203,14 @@
(defn v2-dump
"Exports Metabase app data to directory at path"
[path {:keys [user-email collection-ids] :as opts}]
[path {:keys [collection-ids] :as opts}]
(log/info (trs "Exporting Metabase to {0}" path) (u/emoji "🏭 🚛💨"))
(mdb/setup-db!)
(check-premium-token!)
(t2/select User) ;; TODO -- why??? [editor's note: this comment originally from Cam]
(serdes/with-cache
(-> (cond-> opts
(seq collection-ids) (assoc :targets (v2.extract/make-targets-of-type "Collection" collection-ids))
user-email (assoc :user-id (t2/select-one-pk User :email user-email :is_superuser true)))
(seq collection-ids) (assoc :targets (v2.extract/make-targets-of-type "Collection" collection-ids)))
v2.extract/extract
(v2.storage/store! path)))
(log/info (trs "Export to {0} complete!" path) (u/emoji "🚛💨 📦"))
......
......@@ -206,15 +206,9 @@
(defn ^:command export
{:doc "Serialize Metabase instance into directory at `path`."
:arg-spec [["-u" "--user EMAIL" "Include collections owned by the specified user"
:id :user-email]
["-c" "--collection ID" "Export only specified ID; may occur multiple times."
:id :collections
:multi true
:parse-fn #(Integer/parseInt %)
:update-fn (fnil conj [])]
[nil "--collections ID_LIST" "(Legacy-style) Export collections in comma-separated list of IDs, e.g. '123,456'."
:parse-fn (fn [s] (map #(Integer/parseInt %) (str/split s #"\s*,\s*")))]
:arg-spec [["-c" "--collection ID" "Export only specified ID(s). Use commas to separate multiple IDs."
:id :collection-ids
:parse-fn (fn [raw-string] (map parse-long (str/split raw-string #"\s*,\s*")))]
["-C" "--no-collections" "Do not export any content in collections."]
["-S" "--no-settings" "Do not export settings.yaml"]
["-D" "--no-data-model" "Do not export any data model entities; useful for subsequent exports."]
......
......@@ -47,10 +47,14 @@
{}
["--collection" "123"]
{:collections [123]}
{:collection-ids [123]}
["-c" "123, 456"]
{:collection-ids [123 456]}
["-c" "123,456,789"]
{:collection-ids [123 456 789]}
["-c" "123" "-c" "456"]
{:collections [123 456]}
["--include-field-values"]
{:include-field-values true}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment