Comments (5)
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.
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.
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.
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.
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)
- auth/refresh 400 error HOT 7
- _fields within deep Query not working HOT 4
- Date alias fields don't have same return type as plain fields
- Logical operators to filter service data isn't working after upgrade HOT 2
- Item Drawer sets readonly on circular field which is persisted to the original field
- File Library card thumbnails dissapear when adding a relation to itself HOT 2
- Does anyone have turtorial to intergrate AWS X-ray with Directus on ecs fargate? HOT 1
- `module_bar` in settings doesn't take an array. HOT 1
- Issue still persisting
- `module_bar` in settings doesn't really take an array.
- `useShortcut` hijacks global shortcuts even if targeted to element
- Interface display in editting item mode HOT 1
- Inaccuracy on "Data Model" page HOT 1
- Filtering a collection using comparison operators on String fields results in 400 Bad Request Error HOT 1
- Wrong primaryKey & field values on custom interfaces after upgrading Directus
- Order of "Related Collection" tables is not alphabetically HOT 2
- Unable to create new user via api HOT 4
- Add more detail on icons used in directus HOT 2
- Directus SDK doesn't return file relational data HOT 2
- Authorization header malformed, unexpected scope: 20240624/auto/s3/aws4_request
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directus.