Serialization via the API issue

I’m trying to import serialized Metabase data via Metabase’s API, but can’t get it to work as expected.

This is what I’ve done so far:

  1. Successfully exported a serialized collection from Metabase via the API and saved it as the file export.tar.gz.
  2. I have tried to import this file again via the API with success.
  3. I have extracted the file with the following command: tar -xvf export.tar.gz. After that I have tried to crate a new gzipped tar file by invoking the following from a folder with only the content I just extracted. I have used the following command: tar -czvf export.tar.gz .
  4. After this I have verified that the content of this new tar file is the same as the one I downloaded via the export API.
  5. Finally, I have tried to import the new file via the API, but this fails.

I would love if somebody could help me understand why this doesn’t work. My plan is to manually edit the yaml files before importing them again, but before doing so I want to verify that this works.

It can be good to mention that I have also noted that my tar file is significantly larger than the tar file downloaded from Metabase. Do you have any idea why it can be like that?

The only thing the logs in Metabase shows are this after I’ve tried to import my new file:

metabase-1  | 2024-09-13 21:19:52,698 INFO serialization.api :: Serdes import, size 1910
metabase-1  | 2024-09-13 21:19:52,751 DEBUG middleware.log :: POST /api/ee/serialization/import 200 67.5 ms (11 DB calls) App DB connections: 0/10 Jetty threads: 3/50 (4 idle, 0 queued) (53 total active threads) Queries in flight: 0 (0 queued) {:metabase-user-id 1}

Due to this, it looks like everything works, but it doesn’t. When I import the original file I can see logs that looks like this instead:

metabase-1  | 2024-09-13 21:19:47,442 INFO serialization.api :: Serdes import, size 1038
metabase-1  | 2024-09-13 21:19:47,565 INFO v2.load :: Loading Collection ZtdRUmQZ4_iNq2k6rhkwZ
metabase-1  | 2024-09-13 21:19:47,594 INFO v2.load :: Loading Setting aggregated-query-row-limit

Environment

  • Metabase 1.50.8
  • I’m running those commands on a Macbook M2, with Metabase running in a docker container. (Enterprice license enabled).

My theories so far:

  • Metabase creates the archive file in a different way. But how?
  • I have verified that all the files is in UTF8. I have also tried to chmod all files with 777 before creating my tar file. I’ve also tried to create a metabase user and group on my computer and chown them so that it looks like the original file.

Thanks in advance!

I think I just answered my own question.

I installed GNU Tar (gtar), as I thought it might behave differently than the default macOS tar:

brew install gnu-tar

After that I re-ran the compress command, but with gtar instead of tar and the import via the API worked.

1 Like

can the metabase team please look into this as gnu tar not an option for Windows users and have the same error