#How to migrate SQL or CSV data to Appwrite?

39 messages · Page 1 of 1 (latest)

proper siren
#

I have a MySQL database and I also have it in CSV and I would like to import it into Appwrite. Would you have a solution for that? THANK YOU in advance.

rotund wasp
buoyant briar
edgy pumice
#

I get format exception error

#

Can anybody help me?

#

When run the function i get this error

buoyant briar
#

run main_test to see what is breaking

edgy pumice
#

By the way i have fixed this specific error but now i get this error when running main_test file

buoyant briar
#

are you running the main_test file on your machine, not in appwrite? here is working

edgy pumice
#

oh yes i am running it in appwrite function

buoyant briar
#

run on your machine, outside of appwrite

#

sorry I made this function for another member here in the group, later I will improve the readme

edgy pumice
#

i ran the function it says {csvRow: AppwriteException: document_invalid_structure, Invalid document structure: Unknown attribute: "churchId" (400)}

#

do i need to create the same attributes as in csv file or i dont need to do this

#

i put inside the fileid, storageid ... my bucket and fle id

#

oh i see now i must to completely edit the main

#

file '' try {
for (final csvRow in csvTable) {
final document = await ServerAppwrite.instance.databases.createDocument(
databaseId: payload['databaseId'],
collectionId: payload['collectionId'],
documentId: 'unique()',
data: {
"churchId": csvRow[0],
"title": csvRow[1],
"module": csvRow[2],
},
);
} ''

#

the data section

#

so i do need to specify all the csv row as attributes in my appwrite console i think, and then map it inside data section

#

is it right

buoyant briar
#

As it is an example function, you need to adapt it to your collection

edgy pumice
#

is it not possible right now with some tool maybe to just copy all the csv file and make it as appwrite collection automatically?

buoyant briar
#

I understand your need, then I will create another function

#

I can't promise right now but it's relatively simple, however I'm working

edgy pumice
#

thats very nice from you thank you, but is it even possible such thing?

buoyant briar
#

very very simple, I believe that if you play this code in chatGPT and ask it to create the collection if it does not exist, it would succeed

edgy pumice
#

oh ithaught it would be difficult even not possible i thaught

#

i will then try maybe i succeed

#

it would be very perfect and helpful if such feauture exists in appwrite console itself.

buoyant briar
#

I think it will be more annoying to determine the type of the attribute but nothing that some if can't solve

edgy pumice
#

ok

buoyant briar
#

there are some things on github about importing and exporting data to appwrite, give it a look. I believe this feature will exist, not now but certainly will

edgy pumice
#

can you reference any link?

buoyant briar
#

I don't have it but you can look for it in the issues

edgy pumice
#

oh ok i will look then

#

by the way thank you very much for your time and responces.