update readme (#11)
* update readme * add docs & README to main workflow ignore paths
This commit is contained in:
@@ -5,14 +5,18 @@ name: Main Extension Distribution Pipeline
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "ts/**"
|
|
||||||
- ".github/workflows/TypeScriptWorkspace.yml"
|
- ".github/workflows/TypeScriptWorkspace.yml"
|
||||||
|
- "docs/**"
|
||||||
|
- "ts/**"
|
||||||
|
- "README.md"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "ts/**"
|
|
||||||
- ".github/workflows/TypeScriptWorkspace.yml"
|
- ".github/workflows/TypeScriptWorkspace.yml"
|
||||||
|
- "docs/**"
|
||||||
|
- "ts/**"
|
||||||
|
- "README.md"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
88
README.md
88
README.md
@@ -1,24 +1,14 @@
|
|||||||
# duckdb-ui
|
# DuckDB UI Extension
|
||||||
|
|
||||||
This extension provides a user interface for DuckDB, allowing you to interact with DuckDB through a web-based interface. This repository is based on https://github.com/duckdb/extension-template, check it out if you want to build and ship your own DuckDB extension.
|
A [DuckDB extension](https://duckdb.org/docs/stable/core_extensions/ui.html) providing a browser-based user interface.
|
||||||
|
|
||||||
---
|
This repository contains both the extension, implemented in C++, and some packages used by the user interface, implemented in TypeScript.
|
||||||
|
|
||||||
## Building
|
While most of the user interface code is not yet publicly available, more of it will added here over time.
|
||||||
|
|
||||||
### Managing dependencies
|
## Extension
|
||||||
|
|
||||||
DuckDB extensions uses VCPKG for dependency management. Enabling VCPKG is very simple: follow the [installation instructions](https://vcpkg.io/en/getting-started) or just run the following:
|
The primary structure of this repository is based on the [DuckDB extension template](https://github.com/duckdb/extension-template).
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/Microsoft/vcpkg.git
|
|
||||||
./vcpkg/bootstrap-vcpkg.sh
|
|
||||||
export VCPKG_TOOLCHAIN_PATH=`pwd`/vcpkg/scripts/buildsystems/vcpkg.cmake
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: VCPKG is only required for extensions that want to rely on it for dependency management. If you want to develop an extension without dependencies, or want to do your own dependency management, just skip this step. Note that the example extension uses VCPKG to build with a dependency for instructive purposes, so when skipping this step the build may not work without removing the dependency.
|
|
||||||
|
|
||||||
### Build steps
|
|
||||||
|
|
||||||
To build the extension:
|
To build the extension:
|
||||||
|
|
||||||
@@ -38,66 +28,38 @@ This will create the following binaries:
|
|||||||
- `unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
|
- `unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
|
||||||
- `ui.duckdb_extension` is the loadable binary as it would be distributed.
|
- `ui.duckdb_extension` is the loadable binary as it would be distributed.
|
||||||
|
|
||||||
## Running the extension
|
|
||||||
|
|
||||||
To run the extension code, simply start the shell with `./build/release/duckdb`.
|
To run the extension code, simply start the shell with `./build/release/duckdb`.
|
||||||
|
|
||||||
Now we can use the features from the extension directly in DuckDB. The template contains a single scalar function `ui()` that takes a string arguments and returns a string:
|
To start the UI from the command line:
|
||||||
|
|
||||||
```
|
```
|
||||||
D select ui('Jane') as result;
|
./build/release/duckdb -ui
|
||||||
┌───────────────┐
|
|
||||||
│ result │
|
|
||||||
│ varchar │
|
|
||||||
├───────────────┤
|
|
||||||
│ Ui Jane 🐥 │
|
|
||||||
└───────────────┘
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running the tests
|
To start the UI from SQL:
|
||||||
|
```
|
||||||
Different tests can be created for DuckDB extensions. The primary way of testing DuckDB extensions should be the SQL tests in `./test/sql`. These SQL tests can be run using:
|
call start_ui();
|
||||||
|
|
||||||
```sh
|
|
||||||
make test
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installing the deployed binaries
|
For more usage details, see the [documentation](https://duckdb.org/docs/stable/core_extensions/ui.html).
|
||||||
|
|
||||||
To install your extension binaries from S3, you will need to do two things. Firstly, DuckDB should be launched with the
|
## User Interface Packages
|
||||||
`allow_unsigned_extensions` option set to true. How to set this will depend on the client you're using. Some examples:
|
|
||||||
|
|
||||||
CLI:
|
Some packages used by the browser-based user interface can be found in the `ts` directory.
|
||||||
|
|
||||||
```shell
|
See the [README](ts/README.md) in that directory for details.
|
||||||
duckdb -unsigned
|
|
||||||
```
|
|
||||||
|
|
||||||
Python:
|
## Architectural Overview
|
||||||
|
|
||||||
```python
|
The extension starts an HTTP server that both serves the UI assets (HTML, JavaScript, etc.)
|
||||||
con = duckdb.connect(':memory:', config={'allow_unsigned_extensions' : 'true'})
|
and handles requests to run SQL and perform other DuckDB operations.
|
||||||
```
|
|
||||||
|
|
||||||
NodeJS:
|
The server proxies requests for UI assets and fetches them from a remote server.
|
||||||
|
By default, this is `https://ui.duckdb.org`, but it can be [overridden](https://duckdb.org/docs/stable/core_extensions/ui.html#remote-url).
|
||||||
|
|
||||||
```js
|
The server also exposes a number of HTTP endpoints for performing DuckDB operations.
|
||||||
db = new duckdb.Database(':memory:', {"allow_unsigned_extensions": "true"});
|
These include running SQL, interrupting runs, tokenizing SQL text, and receiving events (such as catalog updates).
|
||||||
```
|
For details, see the `HttpServer::Run` method in [http_server.cpp](src/http_server.cpp).
|
||||||
|
|
||||||
Secondly, you will need to set the repository endpoint in DuckDB to the HTTP url of your bucket + version of the extension
|
The UI uses the TypeScript package [duckdb-ui-client](ts/pkgs/duckdb-ui-client/package.json) for communicating with the server.
|
||||||
you want to install. To do this run the following SQL query in DuckDB:
|
See the [DuckDBUIClient](ts/pkgs/duckdb-ui-client/src/client/classes/DuckDBUIClient.ts) and [DuckDBUIClientConnection](ts/pkgs/duckdb-ui-client/src/client/classes/DuckDBUIClientConnection.ts) classes exposed by this package for details.
|
||||||
|
|
||||||
```sql
|
|
||||||
SET custom_extension_repository='bucket.s3.eu-west-1.amazonaws.com/<your_extension_name>/latest';
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that the `/latest` path will allow you to install the latest extension version available for your current version of
|
|
||||||
DuckDB. To specify a specific version, you can pass the version instead.
|
|
||||||
|
|
||||||
After running these steps, you can install and load your extension using the regular INSTALL/LOAD commands in DuckDB:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
INSTALL ui
|
|
||||||
LOAD ui
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user