I want to create a Fauna DB and make bulk inserts with test data (create multiple documents in multiple collections) using a script like you do in an sql databases where you run an sql script.
For Fauna there are 2 ways of manipulating the data: using fql or using graphql.
I don’t necessarily want to use only the fql way.
I want to find the easiest and the most efficient way to do this.
For creating the database I think the easiest way is to use a graphql schema and import it
But to bulk insert test data into the db, I am not sure how to do it and what is the easiest way.
- Using FQL
I can use fauna shell and this command: fauna eval with an fql file but it does not support multiple fql queries inside the file
I can use fauna shell to run multiple fql queries but it’s a reusable approach.
- Using Graphql
- I can create multiple mutations for creating the data and execute them in a http client (or maybe creating a script and parse it for every graphql request) like in the pic below but it takes too long and again it’s not a reusable approach.
If you notice some improvements that I can make to my approaches that would bring me closer to the expected result or if you already experienced other solutions for this problem I would appreciate verry much a reply to this topic!