Giter Club home page Giter Club logo

Comments (5)

br41nslug avatar br41nslug commented on June 24, 2024

This is correct, the import does not magically look up the corresponding primary key. It expects the primarykey/foreignkey (or complete object for creation) to be the one imported. Make sure to export the actual value not the display label when exporting for re-import.

Feel free to create a feature request for this 😄

from directus.

BI-MarcB avatar BI-MarcB commented on June 24, 2024

Are there any docs for this? Especially regarding the entity creation in the related collection?

I think it is worrisome that interface settings have an impact on import/export behaviour, especially without any confirmation.

from directus.

br41nslug avatar br41nslug commented on June 24, 2024

https://docs.directus.io/user-guide/content-module/import-export.html#import-export
https://docs.directus.io/reference/system/utilities.html#import-data-from-file

The import and export function of the API behave no different than updating/creating and reading in the rest of the API but with files as input/output instead of a http response -> https://docs.directus.io/reference/introduction.html#relational-data

I think it is worrisome that interface settings have an impact on import/export behaviour

Only if you're using the web App instead of the API to export then yes the export interface will default to your currently selected fields and filters (unless you change that to the desired fields when exporting, it's just a pre-fill). Not all export usecases are meant to be re-imported into the same system (think external systems)

especially without any confirmation.

why would you need confirmation on a manual export action? confirmation of what? you get presented with all the options you're about to export which you really should check/confirm are wanted before pressing the export button

from directus.

BI-MarcB avatar BI-MarcB commented on June 24, 2024

From the linked docs, it is not clear that an import of relational data will create data in referenced collections. There is also no mention in the import/export docs to check the related API docs.

why would you need confirmation on a manual export action?

This was referring to the import. An import in collection A creating an entry in collection B without confirmation is unexpected. Especially as 'name' looks like a valid FK in the frontend and in the export.

from directus.

joehannouch avatar joehannouch commented on June 24, 2024

I have the same scenario where i exported a collection to see how it looks, but i'm not able to fill the csv (excel) manually with collection_id.name since new rows will be created when i import the file, i "have" to use the ids, which is not practical at all, i was considering sending the file to an editor for him to fill around 1000 entries with M2M by name, It's just not possible to ask of them to insert the M2M (category in my case) by UDID, it's just not readable by a human:

This works but is not readable:
"[{""collection_id"":{""id"":""a854913b-8b6d-48c9-9e75-0610871a29e9""}}]"

This creates a new collection (even :
"[{""collection_id"":{""name"":""Tech""}}]"

I know that the first one works since id is the primary key, but i find it counter intuitive to have to process and parse the csv and build a json out of it in order to use that for the import (at least this is what i'm planning to do but still debating the decision).
Maybe i can make the title as a primary key in this instance?

from directus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.