You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.
4
+
5
+
---
6
+
7
+
This extension, Quack, allow you to ... <extension_goal>.
8
+
9
+
10
+
## Building
11
+
### Managing dependencies
12
+
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:
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.
-`duckdb` is the binary for the duckdb shell with the extension code automatically loaded.
32
+
-`unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
33
+
-`quack.duckdb_extension` is the loadable binary as it would be distributed.
34
+
35
+
## Running the extension
36
+
To run the extension code, simply start the shell with `./build/release/duckdb`.
37
+
38
+
Now we can use the features from the extension directly in DuckDB. The template contains a single scalar function `quack()` that takes a string arguments and returns a string:
39
+
```
40
+
D select quack('Jane') as result;
41
+
┌───────────────┐
42
+
│ result │
43
+
│ varchar │
44
+
├───────────────┤
45
+
│ Quack Jane 🐥 │
46
+
└───────────────┘
47
+
```
48
+
49
+
## Running the tests
50
+
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:
51
+
```sh
52
+
make test
53
+
```
54
+
55
+
### Installing the deployed binaries
56
+
To install your extension binaries from S3, you will need to do two things. Firstly, DuckDB should be launched with the
57
+
`allow_unsigned_extensions` option set to true. How to set this will depend on the client you're using. Some examples:
58
+
59
+
CLI:
60
+
```shell
61
+
duckdb -unsigned
62
+
```
63
+
64
+
Python:
65
+
```python
66
+
con = duckdb.connect(':memory:', config={'allow_unsigned_extensions' : 'true'})
67
+
```
68
+
69
+
NodeJS:
70
+
```js
71
+
db =newduckdb.Database(':memory:', {"allow_unsigned_extensions":"true"});
72
+
```
73
+
74
+
Secondly, you will need to set the repository endpoint in DuckDB to the HTTP url of your bucket + version of the extension
75
+
you want to install. To do this run the following SQL query in DuckDB:
76
+
```sql
77
+
SET custom_extension_repository='bucket.s3.eu-west-1.amazonaws.com/<your_extension_name>/latest';
78
+
```
79
+
Note that the `/latest` path will allow you to install the latest extension version available for your current version of
80
+
DuckDB. To specify a specific version, you can pass the version instead.
81
+
82
+
After running these steps, you can install and load your extension using the regular INSTALL/LOAD commands in DuckDB:
0 commit comments