1

I have an arrow table that I'm trying to query with DuckDB_wasm but I'm getting an error that the table doesn't exist. I have this...

const dlURL="http://localhost:7071/api/getdata"
const arrowTable  = await tableFromIPC(fetch(dlURL))
const c = await db.connect();

await c.insertArrowTable(arrowTable , {name: 'arrowTable'})
let qres = await c.query("select * from arrowTable")

To be clear, arrowTable definitely exists. I think I'm just missing the proper syntax between insertArrowTable and the subsequent query.

Dean MacGregor
  • 11,847
  • 9
  • 34
  • 72

2 Answers2

1

I think I just needed to create the table first

const c = await db.connect();
await c.query("create table arrowTable(name VARCHAR, age integer)")
await c.insertArrowTable(arrowTable , {name: 'arrowTable'})
let qres = await c.query("select * from arr
Dean MacGregor
  • 11,847
  • 9
  • 34
  • 72
0

Thanks for raising this, I will have to double check from a console, but I have a hunch: could you try providing a {schema: 'main', name: 'arrowTable'} as option to insertArrowTable?

  • 1
    happy to try that out later but did you see the answer I posted about needing to create the table first? That fixed my issue so I'm not sure if your point is that if I specify the schema that it would auto create the table or if you just didn't see that the problem was I didn't create the table in advance. – Dean MacGregor Jul 27 '23 at 10:30
  • I guess I was expecting a different behaviour and / or some clarification would be otherwise useful here: https://github.com/duckdb/duckdb-wasm/blob/12587940485dc85dc6050bfe0bc9b00aad795f49/packages/duckdb-wasm/README.md?plain=1#L115. – Carlo Piovesan Jul 27 '23 at 11:13