Skip to content
Snippets Groups Projects
Unverified Commit f651588b authored by John Swanson's avatar John Swanson Committed by GitHub
Browse files

Skip excess keys on serialization load (#35748)


When loading from a backup, we should not fail if the previous version saved keys that are no longer needed in the
current version. This adds a step (after ingestion but before loading) that removes any "extra" keys from the ingested
entity.

How?

- make `load-xform-basics` remove extraneous keys from the ingested model.

- by default, it identifies the "extraneous keys" as keys *other than* keys corresponding to column names in the database.

- for *some* ingested models, there is not a 1:1 correlation between an ingested model and a `:metabase/model`. For example, when we ingest an `"Action"`, that corresponds to the `:model/Action` model. But that model has three "submodels" - `:model/QueryAction`, `:model/HttpAction`, and `:model/ImplicitAction` - and when we load the ingested map into the database, `action/insert!` will insert subsets of the map it receives into _two_ tables (`action` plus one of the submodel tables).

- to handle this case, `serdes/ingested-model-columns` is a multimethod, which we can override. For example, for `"Action", we override it to include the full set of columns that exist in any of the model/submodel tables.

Co-authored-by: default avatarbryan <343288+escherize@users.noreply.github.com>
parent cfe72f69
No related branches found
No related tags found
No related merge requests found
Loading
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