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
fix(build): rename HttpMethod::DELETE to DEL for Windows compat
Windows headers define DELETE as a macro, causing MSVC build failures.
Also update development docs with repo layout, testing guide, and CI
pipeline overview. Add CLAUDE.md for quick reference.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
DuckDB extension for reading and writing Google Sheets.
4
+
5
+
## Quick Reference
6
+
7
+
-**Build:**`GEN=ninja make`
8
+
-**Unit tests:**`make test_unit`
9
+
-**SQL tests:**`TOKEN=your-token make test` or `./scripts/test_sql.sh path/to/keyfile.json`
10
+
-**Format:**`make format`
11
+
12
+
## Architecture
13
+
14
+
The extension has three layers: **Transport** (HTTP client abstraction), **Auth** (bearer token, OAuth, service account), and **Service** (Google Sheets API client with spreadsheet/values resources). See `src/include/sheets/` for the interfaces.
15
+
16
+
## Contributing
17
+
18
+
See [docs/pages/development.md](docs/pages/development.md) for build setup, testing, repo layout, and CI pipeline details.
│ └── unit/ # C++ unit tests (standalone, no credentials needed)
20
+
├── scripts/ # Dev scripts (test runners, token generation)
21
+
├── docs/ # Documentation site
22
+
├── .github/workflows/ # CI pipelines
23
+
├── duckdb/ # DuckDB submodule
24
+
└── extension-ci-tools/ # DuckDB CI tooling submodule
25
+
```
26
+
3
27
## Building
28
+
4
29
### Managing dependencies
5
-
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:
30
+
31
+
DuckDB extensions use VCPKG for dependency management. Follow the [installation instructions](https://vcpkg.io/en/getting-started) or run:
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.
12
38
13
39
### Build steps
14
-
Now to build the extension, run:
40
+
41
+
To build the extension:
42
+
15
43
```sh
16
44
GEN=ninja make
17
45
```
46
+
18
47
The main binaries that will be built are:
48
+
49
+
-`./build/release/duckdb` — DuckDB shell with the extension auto-loaded
50
+
-`./build/release/test/unittest` — SQL test runner with the extension linked in
-`duckdb` is the binary for the duckdb shell with the extension code automatically loaded.
25
-
-`unittest` is the test runner of duckdb. Again, the extension is already linked into the binary.
26
-
-`gsheets.duckdb_extension` is the loadable binary as it would be distributed.
27
66
28
-
## Running the extension
29
-
To run the extension code, simply start the shell with `./build/release/duckdb`.
67
+
### SQL tests
30
68
31
-
Now we can use the features from the extension directly in DuckDB.
69
+
SQL tests run against the real Google Sheets API and require credentials. There are two ways to run them:
32
70
33
-
## Running the tests\
34
-
To run the test suite, you need to generate a token for the Google Sheets API, follow the instructions in the README file to get one.
71
+
**Option 1: With an access token**
72
+
73
+
If you already have a Google Sheets API access token:
35
74
36
-
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:
37
75
```sh
38
-
TOKEN=your-token-here GEN=ninja make test
76
+
TOKEN=your-token-here make test
77
+
```
78
+
79
+
**Option 2: With a service account key file**
80
+
81
+
If you have a service account JSON key file, the test script will generate a token and set up both `TOKEN` and `KEY_FILE_PATH` for you:
82
+
83
+
```sh
84
+
./scripts/test_sql.sh path/to/keyfile.json
85
+
```
86
+
87
+
This script will:
88
+
1. Set up a Python venv and install dependencies
89
+
2. Generate an access token from the key file
90
+
3. Set `TOKEN` and `KEY_FILE_PATH` environment variables
91
+
4. Run `make test` (builds DuckDB + extension, then runs SQL logic tests)
92
+
93
+
To obtain a key file, create a Google Cloud service account with access to the test spreadsheets and download its JSON key. See [Google's documentation](https://cloud.google.com/iam/docs/keys-create-delete) for details.
94
+
95
+
## CI Pipeline
96
+
97
+
The CI pipeline gates builds behind tests:
98
+
99
+
```mermaid
100
+
graph LR
101
+
A[push / pull_request] --> B[Unit Tests]
102
+
B --> C[SQL Tests]
103
+
C --> D[Build next]
104
+
C --> E[Build stable]
39
105
```
40
106
41
-
### Installing the deployed binaries
42
-
To install your extension binaries from S3, you will need to do two things. Firstly, DuckDB should be launched with the
43
-
`allow_unsigned_extensions` option set to true. How to set this will depend on the client you're using. Some examples:
107
+
-**Unit tests** — always run, no credentials needed
108
+
-**SQL tests** — require `GSHEETS_KEY_FILE_JSON` repo secret; skip gracefully on fork PRs without credentials
109
+
-**Distribution builds** — only start after both test stages pass
110
+
111
+
For fork PRs, maintainers can manually trigger SQL tests via **Actions → SQL Tests → Run workflow**.
112
+
113
+
## Installing deployed binaries
114
+
115
+
DuckDB must be launched with `allow_unsigned_extensions` set to true:
44
116
45
117
CLI:
46
118
```shell
@@ -57,15 +129,14 @@ NodeJS:
57
129
db =newduckdb.Database(':memory:', {"allow_unsigned_extensions":"true"});
58
130
```
59
131
60
-
Secondly, you will need to set the repository endpoint in DuckDB to the HTTP url of your bucket + version of the extension
61
-
you want to install. To do this run the following SQL query in DuckDB:
132
+
Set the repository endpoint to your bucket:
133
+
62
134
```sql
63
135
SET custom_extension_repository='bucket.s3.eu-west-1.amazonaws.com/<your_extension_name>/latest';
64
136
```
65
-
Note that the `/latest` path will allow you to install the latest extension version available for your current version of
66
-
DuckDB. To specify a specific version, you can pass the version instead.
67
137
68
-
After running these steps, you can install and load your extension using the regular INSTALL/LOAD commands in DuckDB:
0 commit comments