Skip to content

DuckDB.of doesn't ingest relative FileAttachments #190

Closed
@Fil

Description

@Fil

EDIT: this now works, but needs to be cleaned up once we ship a new version of stdlib.


This does not currently work:

const db = await DuckDBClient.of({penguins: FileAttachment("simple-parquet.parquet")});

A work-around is to force the URL to be absolute:

function absoluteFA(FA) {
  const {url} = FA;
  FA.url = async function() {
    return new URL(await url.apply(FA), document.location.href).href;
  }
  return FA;
}

then call:

const db = await DuckDBClient.of({penguins: absoluteFA(FileAttachment("simple-parquet.parquet"))});

Maybe that could be fixed in stdlib, https://github.com/observablehq/stdlib/blob/301bd60f43b7416ea4a82a297f0dd287bef83410/src/duckdb.js#L174C36-L174C45

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions