RealT
Import a CSV file with text[] column type
I kept getting invalid column type [text[]] error when trying to import a csv file into a new table with a text[] column type. I tried to import a csv file that is exported from an existing table and it still failed because of that column. This is one of the rows in my csv file and the second column is of text[] type. Any ideas?
rec_csi6284le37f553ij520,"[""All and Together"",""End and Final""]",2024-11-01T05:03:28.353467Z,2024-11-06T06:39:28.877725Z,2,7097,193,end,קצה
5 replies
How to run X number of operations in transaction
Hi, I am trying to upsert multiple records. According to the doc, I'll have to create update operations in transaction like before.
const result = await xata.transactions.run([
{ update: { table: 'titles', id: 'new-1', fields: { originalTitle: 'The third' }, upsert: true } },
...
]);
However, the number of upsert is determined at runtime. Is it possible to pass in a dynamic array of operations into the run function? I have tried the following and it complains a type mismatch.
var op1 = { update: { table: 'titles', id: 'new-1', fields: { originalTitle: 'The first' }, upsert: true } },
var op2 = { update: { table: 'titles', id: 'new-2', fields: { originalTitle: 'The second' }, upsert: true } },
var ops = { op1, op2 }
const result = await xata.transactions.run([ ops ]);
3 replies