Collection Import AND/OR CLI to import files?


#1

I have some data in json format that can correspond to collection structure, can I import a collection file to cockpit?
I see that there is import button in assets and in modules/Collections/cli folder there are some import export scripts, but anyone know how to use them?

Are there any CLI commands for cockpit?


#2

I would love to know, how can I import my data too.


#3

I think no-one answered to me because to answer was so obvious and I found it later.
you can find Import/export in menu that you can see when you hover over collection:

menu

import it self let you even import relations to other collections (you can filter fields), which is very cool and let you quickly get your data in place.
But for some reason if you export data and then reimport it with cockpit it cannot make the connectionLink correctly


#4

@kosma
Thank you for your answer.

but strangely nothing appear when i’m on my collection and when i hover the name.

so bad :frowning:


#5

sounds like you are missing the needed access rights to import data - retry it as admin user


#7

Right, we need to be admin!

Is someone know how to transform MySQL database to JSON file?
I already created a JSON file from my SQL server:

places: [

 {
   id: "2",

   structure_id: "2",

   nom: "Allô Candy asbl",

   secteur: "0-3",

   adresse: "9, rue Louis Bréguet",

   codepostal: "6041",

   ville: "Gosselies",

   telephone: "071/45.03.33",

   gsm: "",

   email: "allo-candy.accueil@hotmail.be",

   web: "www.allocandy.be",

   description: "La Crèche d'Allo Candy asbl dispose de 48 places.",

   categorie1: "Structure d'accueil",

   souscat1: "Crèche",

   souscat2: "",

   latitude: "50.47487",

   longitude: "4.47205"},

 { ...

#8

just did a quick google search. Try this:

https://www.csvjson.com/sql2json


#9

Btw, you can also import csv files :point_up:


#10

Hi,

Actually when we try to import our JSON file, we got this:

and nothing move further.

Do you know why?

Thank you,
Une Nouvelle Ville ASBL


#11

try pressing Control+Shift+J in order to open the chrome developer console (guessing you are using chrome). Check if there are any console errors when you are trying to import data