CereusDB API Documentation
    Preparing search index...

    Class CereusDB

    Index

    Methods

    • Rename a table or add, drop, or rename a column.

      Parameters

      Returns Promise<void>

    • Open an existing persistent database. Equivalent to ATTACH 'opfs://mydb' [AS name]. Resolves to the database name.

      Parameters

      Returns Promise<string>

    • Rewrite all tables of a persistent database into one segment each.

      Parameters

      • name: string

      Returns Promise<void>

    • Create a persistent database, for example opfs://mydb, and attach it as a catalog. Equivalent to CREATE DATABASE 'opfs://mydb'. Resolves to the database name.

      Parameters

      Returns Promise<string>

    • Write pending changes and close a persistent database. Equivalent to DETACH name.

      Parameters

      • name: string
      • Optionaloptions: { ifExists?: boolean }

      Returns Promise<void>

    • Export a table or query result as GeoParquet and pass it to the export handler: a browser download by default (see onExport in CereusDBOptions). Resolves to the file name.

      Parameters

      Returns Promise<string>

    • Drop a database by name or location. Persistent databases are deleted from storage. Equivalent to DROP DATABASE.

      Parameters

      • nameOrLocation: string
      • Optionaloptions: { ifExists?: boolean }

      Returns Promise<void>

    • Drop a table. The table is removed immediately; for tables of persistent databases the returned promise resolves once the change is written.

      Parameters

      • name: string

      Returns Promise<void>

    • Export a table or query result as a GeoParquet (1.1) file. Geometry and geography columns are described in the file's geo metadata.

      Parameters

      Returns Promise<Uint8Array<ArrayBuffer>>

    • Write pending changes of persistent databases (for example after registerGeoJSON()).

      Returns Promise<void>

    • Insert Arrow IPC data (stream or file format, for example from tableToIPC() of apache-arrow) into a table. Columns are matched by name; missing columns are filled with NULL. Resolves to the number of inserted rows.

      Parameters

      • table: string
      • data: BufferSource

      Returns Promise<number>

    • Attached databases plus stored databases that are not attached.

      Returns Promise<DatabaseListing[]>

    • Register a local file (from File API / drag-and-drop) as a table. Currently supports Parquet, GeoJSON, and GeoTIFF rasters.

      Parameters

      • name: string
      • file: File

      Returns Promise<void>

    • Register a GeoJSON object or string as a table.

      Parameters

      • name: string
      • geojson: string | object

      Returns void

    • Register a GeoTIFF buffer as a single-column raster table. Requires the full GDAL-enabled package build.

      Parameters

      • name: string
      • data: BufferSource

      Returns void

    • Register a remote Parquet object or prefix through DataFusion's listing table path.

      Parameters

      Returns Promise<void>

    • Register a raster buffer as a single-column raster table. Requires the full GDAL-enabled package build.

      Parameters

      Returns void

    • Register a remote Parquet file as a table. The server must support CORS.

      Parameters

      • name: string
      • url: string

      Returns Promise<void>

    • Execute a SQL query and return results as Arrow IPC bytes.

      Parameters

      • query: string

      Returns Promise<Uint8Array<ArrayBuffer>>

    • Execute a SQL query and return results as JSON.

      Parameters

      • query: string

      Returns Promise<Record<string, unknown>[]>

    • List the tables and views of all databases. By default only the table names are returned, which is ambiguous when databases contain tables with the same name; pass { qualified: true } for database.schema.table names, or use CereusDB.catalog for full details.

      Parameters

      • Optionaloptions: { qualified?: boolean }

      Returns string[]

    • Set the default database (and schema). Equivalent to USE database[.schema].

      Parameters

      • database: string
      • Optionalschema: string

      Returns Promise<void>

    • Version string.

      Returns string

    • Create and initialize a new CereusDB instance. This loads the WASM module and initializes the query engine.

      Parameters

      Returns Promise<CereusDB>