A DuckDB server for Mosaic
Project description
Mosaic DuckDB Server
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file duckdb_server-0.7.0.tar.gz
.
File metadata
- Download URL: duckdb_server-0.7.0.tar.gz
- Upload date:
- Size: 11.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d587e1148b6d13a675990242be8a9ff1247e3192a07866c1eb94cbf1742ed6f7 |
|
MD5 | 190d12e4a8bcda3c75603a675b976e2f |
|
BLAKE2b-256 | 7aa98dd1b5b49e6baf8a5e2f5ed91361b4a6388cd7410ac1df7f585cf090d806 |
File details
Details for the file duckdb_server-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: duckdb_server-0.7.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adfc1c1ebe8baf22b7261e2f0f21915772c4903db9f25d62c279f82135688195 |
|
MD5 | 5d57265fed868cdfaa1cdb69df5c5f92 |
|
BLAKE2b-256 | 175ba928ae3d0cc04f7e6bce0f4e249ac20d0895de4f22117ba83a44e850b8c4 |