Use read_csv in duckdb call for a locale file

Hello,
Is such a call allowed

await db.sql`CREATE TABLE longform AS SELECT * FROM read_csv('./data/poem_long_form.csv');`

I got the following Error: IO Error: No files found that match the pattern "./data/poem_long_form.csv", though it feels surprising why this would be an error when the following works

await db.sql`CREATE TABLE addresses
  AS SELECT *
  FROM read_parquet('https://static.data.gouv.fr/resources/bureaux-de-vote-et-adresses-de-leurs-electeurs/20230626-135723/table-adresses-reu.parquet')
  LIMIT 100`;

(the reason im trying this is because this

const db =  await DuckDBClient.of({ 
       longform: FileAttachment("./data/poem_long_form.csv"), 
       prompt: FileAttachment("./data/poem_prompts.csv")
})

for some reason is treating the first line of ./data/poem_prompts.csv as a row and not as a header. not sure why since the spec says otherwise. The first csv loads fine)

thanks much
saptarshi

You can pass additional options to DuckDBClient.of if you need to change the default behavior. For example:

const db = await DuckDBClient.of({ 
  longform: FileAttachment("./data/poem_long_form.csv"), 
  prompt: {
    file: FileAttachment("./data/poem_prompts.csv"),
    header: false
  }
});

You can find the supported options here:

You can’t use read_csv('./path/to/file') in SQL because it is not statically analyzable by Framework, so Framework doesn’t know you need the file, can’t know to generate it with a data loader, include it in the built site, etc.

Thanks much