Skip to main content

A DuckDB server for Mosaic

Project description

Mosaic DuckDB Server

PyPi

A Python-based server that runs a local DuckDB instance and support queries over Web Sockets or HTTP, returning data in either Apache Arrow or JSON format.

Note: This package provides a local DuckDB server. To instead use DuckDB-WASM in the browser, use the wasmConnector in the mosaic-core package.

Installation and usage

We recommend running the server in an isolated environment with pipx. For example, to directly run the server, use:

pipx run duckdb-server

Alternatively, you can install the server with pip install duckdb-server. Then you can start the server with duckdb-server.

Developer Setup

We use hatch to manage our development setup.

Start the server in development with hatch run serve. The server restarts when you change the code.

To run the tests, use hatch run test:cov.

To set up a local certificate for SSL, use https://github.com/FiloSottile/mkcert.

API

The server supports queries via HTTP GET and POST, and WebSockets. The GET endpoint is useful for debugging. For example, you can query it with this url.

Each endpoint takes a JSON object with a command in the type. The server supports the following commands.

exec

Executes the SQL query in the sql field.

arrow

Executes the SQL query in the sql field and returns the result in Apache Arrow format.

json

Executes the SQL query in the sql field and returns the result in JSON format.

create-bundle

Caches the results of the SQL queries in the queries field and the required datasets.

load-bundle

Loads the bundled results.

Publishing

Run the build with hatch build. Then publish with hatch publish. We publish using tokens so when asked, set the username to __token__ and then use your token as the password. Alternatively, create a .pypirc file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duckdb_server-0.9.0.tar.gz (11.5 MB view details)

Uploaded Source

Built Distribution

duckdb_server-0.9.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file duckdb_server-0.9.0.tar.gz.

File metadata

  • Download URL: duckdb_server-0.9.0.tar.gz
  • Upload date:
  • Size: 11.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for duckdb_server-0.9.0.tar.gz
Algorithm Hash digest
SHA256 0fa91e9d4a73222afc893baa6e50d9b4f968b93daf1cd4f123ca8401fceb2a28
MD5 208d00be0d644aaf2c9b0c15d003ce79
BLAKE2b-256 8608c7ff759d10914fe88ca1b09181138896dedf5de9046d8acbf82696ae9406

See more details on using hashes here.

File details

Details for the file duckdb_server-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for duckdb_server-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 caaa47ec2bbcf192049c7a2b9df4c281470cbac121909c718d5496bd1d9ed781
MD5 72604c70fc58be9bd31a003b6e511bbc
BLAKE2b-256 36c831b9b87b03e3970f94312fee3c1290c153578a913e2a67e5c52a628f25bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page