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 uvx. For example, to directly run the server, use:

uvx 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 uv to manage our development setup.

Start the server with uv run duckdb-server. The server will not restart when the code changes.

Start the server in development with pnpm dev. The server restarts when you change the code.

Run uv run ruff check --fix and uv run ruff format to lint the code.

To run the tests, use uv run pytest.

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.

Publishing

Run the build with uv build. Then publish with uvx twine upload --skip-existing ../../dist/*. 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.23.0.tar.gz (13.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duckdb_server-0.23.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: duckdb_server-0.23.0.tar.gz
  • Upload date:
  • Size: 13.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for duckdb_server-0.23.0.tar.gz
Algorithm Hash digest
SHA256 e9e66785c0bd9a7ae2c7d8a436a5a84ebf598490c165a605b3c76e569d1ccc33
MD5 de018dab742551e6d8195d9e671e16a2
BLAKE2b-256 f46b00ea418de85fb46acbd3a26f13d7a4ed46875f23f18b9e7bc473f0de18cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: duckdb_server-0.23.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for duckdb_server-0.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92c9b9f966ca9e94f464017f50faa3263bb1d7db6a65190eef45a72fc39e17d4
MD5 0832dd81e880e5a12e3d354c51bb2a88
BLAKE2b-256 2b84e036c654b4edd89b68c2cd611ad66f990d245298571c1bcc65e42ef0c6cb

See more details on using hashes here.

Supported by

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