Skip to content

Use existing duckdb wasm database to render charts #1904

@kalyanm2305

Description

@kalyanm2305

Hi,

I have an angular application where users can interact with parquet files and perform some basic data transformations like filter,sort, pivot . For all the above mentioned transformations, the uploaded file gets stored into a duckdb wasm db as a table. Now I plan to use the same db to create charts using uwdata/mosaic and came across this https://observablehq.com/framework/lib/mosaic.
`import {DuckDBClient} from "npm:@observablehq/duckdb";
import * as vgplot from "npm:@uwdata/vgplot";

const db = await DuckDBClient.of({trips: FileAttachment("nyc-taxi.parquet")});
const coordinator = new vgplot.Coordinator();
coordinator.databaseConnector(vgplot.wasmConnector({duckdb: db._db}));
const vg = vgplot.createAPIContext({coordinator});

Could you please let me know if there is a way to do so? I understand that there is an instance of duckdb wasm that gets created by default and I want to avoid and instead use the tables in the existing duckdb wasm database that my application is using.

Thanks
Kalyan
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions