Skip to content
Snippets Groups Projects
Unverified Commit 7f45c4d7 authored by Braden Shepherdson's avatar Braden Shepherdson Committed by GitHub
Browse files

Serdes v2: Selective serialization from the command line (#25309)

Pass `--collections 123,456,789` to dump only these collections and
their transitive `serdes-descendants`.
parent d182a01e
No related merge requests found
(ns metabase-enterprise.serialization.cmd
(:refer-clojure :exclude [load])
(:require [clojure.tools.logging :as log]
(:require [clojure.string :as str]
[clojure.tools.logging :as log]
[metabase-enterprise.serialization.dump :as dump]
[metabase-enterprise.serialization.load :as load]
[metabase-enterprise.serialization.v2.extract :as v2.extract]
......@@ -173,8 +174,15 @@
(dump/dump-dimensions path)
(log/info (trs "END DUMP to {0} via user {1}" path user)))
(defn- v2-extract [opts]
(if (:collections opts)
(v2.extract/extract-subtrees (assoc opts :targets (for [c (str/split (:collections opts) #",")]
["Collection" (Integer/parseInt c)])))
(v2.extract/extract-metabase opts)))
(defn- v2-dump [path opts]
(v2.storage/store! (v2.extract/extract-metabase opts) path))
(-> (v2-extract opts)
(v2.storage/store! path)))
(defn dump
"Serialized metabase instance into directory `path`."
......
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