Hello, is there an easy way to export the entire data of just a single collection using the cli or docker mariadb commands other than querying from api?
Example I have a Tasks and Projects collection, I just want to export all data from the Tasks collection using cli.
Summary
The user wanted to export the entire data of a collection without using the API. They found a solution using a Docker command to echo the data from the MariaDB container and saved it to a CSV file. They also mentioned a GitHub repository with a cloud function that can export collection data to a CSV file.
rafagazani
Rank 3: Container
Mar 2, 2023, 14:53
I did this with cloud function. it goes through all the documents of a collection and inserts in a csv. At the end save the file in storage. Help you?
Hello! Sorry I forgot to get back, thank you for this snippet ill use it as reference soon. In the end what I did was to echo out from the mariadb container as I did't want to call the api for it, I had to figure out the correct table name though
Bash
docker exec appwrite-mariadb sh -c 'exec mysql -B -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" appwrite -e "SELECT * FROM _1_database_1_collection_6;"' \
| sed "s/\"/\"\"/g;s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > medias.csv