You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to load local CSV file into duckdb-wasm on vs code. However, the file contents (of data.csv) are not successfully loaded into the database if I simply wrote a function as follows:
async function loadData() {
var dbhere = await db;
await dbhere.registerFileBuffer('data.csv', new Uint8Array())
const conn = await dbhere.connect()
await conn.insertCSVFromPath('data.csv', {
schema: 'main',
name: 'data',
detect: false,
header: true,
delimiter: ',',
columns: {
year: new arrow.Int32(),
value: new arrow.Float(256),
}
})
}
There should be something wrong with registerFileBuffer as I should also include a variable called buffer. But I don't know how to add it locally. In the observable examples, we can load the file by FileAttachment('data.csv') and call buffer = file.arrayBuffer(). But how can I do the same thing on my local machine instead of Observable? Also where shall I specify the file path?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to load local CSV file into duckdb-wasm on vs code. However, the file contents (of
data.csv
) are not successfully loaded into the database if I simply wrote a function as follows:There should be something wrong with
registerFileBuffer
as I should also include a variable calledbuffer
. But I don't know how to add it locally. In the observable examples, we can load the file byFileAttachment('data.csv')
and callbuffer = file.arrayBuffer()
. But how can I do the same thing on my local machine instead of Observable? Also where shall I specify the file path?Thank you so much!
Beta Was this translation helpful? Give feedback.
All reactions