{"id":15783602,"url":"https://github.com/timlrx/sqlite-extension-template","last_synced_at":"2026-03-15T11:37:22.577Z","repository":{"id":187505900,"uuid":"677031410","full_name":"timlrx/sqlite-extension-template","owner":"timlrx","description":"Template for building a SQLite extension in C/C++. Builds a loadable module, static extension, python package and WebAssembly distribution.","archived":false,"fork":false,"pushed_at":"2023-08-17T15:12:04.000Z","size":39,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-04T19:44:32.743Z","etag":null,"topics":["c","cpp","python","sqlite","template","wasm"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timlrx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-10T15:18:36.000Z","updated_at":"2024-09-06T05:42:09.000Z","dependencies_parsed_at":"2024-10-04T19:43:44.162Z","dependency_job_id":"ae7dd5de-9ea0-4462-9e9a-237ef653b0d6","html_url":"https://github.com/timlrx/sqlite-extension-template","commit_stats":null,"previous_names":["timlrx/sqlite-extension-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timlrx%2Fsqlite-extension-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timlrx%2Fsqlite-extension-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timlrx%2Fsqlite-extension-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timlrx%2Fsqlite-extension-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timlrx","download_url":"https://codeload.github.com/timlrx/sqlite-extension-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221457490,"owners_count":16825173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","python","sqlite","template","wasm"],"created_at":"2024-10-04T19:42:28.100Z","updated_at":"2026-03-15T11:37:17.532Z","avatar_url":"https://github.com/timlrx.png","language":"Makefile","readme":"# SQLite Custom Extension Template\n\nThis repository contains a template for building custom [SQLite] extensions in C / C++. It supports the following targets:\n\n- Loadable module\n- Static library\n- WebAssembly build with fiddle\n- Python package\n\nCredits goes to [Alex Garcia](https://github.com/asg017/sqlite-ecosystem) for his numerous repositories which I adapted to create this scaffold. Check out his repositories for other build targets. I added a WASM target based on the official SQLite build (more info at my [blog post](https://www.timlrx.com/blog/sqlite-wasm-with-custom-extensions)). The WASM build requires compiling from the raw source tree, instead of relying on the amalgamation distribution.\n\nThe scaffold creates 2 functions (`rot13()` and `rot13_version()`), and a virtual table module with no implementation logic (`rot13`) as an SQLite extension.\n\nThe WASM build copies the contents in `src/` and the pre-processed header files to `sqlite/ext/wasm` and builds it over there. `sqlite_wasm_extra_init.c` is required to initialize the extension and `fiddle.make` overrides the default file and adds the extension to the fiddle.\n\nIf you encounter any issues, it might help to run `git clean -df` in the sqlite submodule before re-running the build process.\n\n## Pre-requisites\n\nIn addition to platform specific build tools (e.g. llvm or build-essentials), the following tools are required:\n\n- [CMake](https://cmake.org/)\n- [Python](https://www.python.org/) with `pip install wheel`\n- [Emscripten](https://github.com/emscripten-core/emsdk.git)\n- [WASM Binary Toolkit](https://github.com/WebAssembly/wabt)\n\n## Getting Started\n\nRun the following command:\n\n1. Clone the repository: `git clone --recurse-submodules https://github.com/username/rot13.git`\n2. Build the loadable module: `make loadable`\n3. Build the static library: `make static`\n4. Build the Python package: `make python`\n5. Build the WebAssembly module and fiddle: `make wasm`\n6. Add your own files to the `src/` directory and update the code in the folders accordingly.\n\n## Repository Structure\n\n```\n.\n├── src/                          # Source code for the SQLite extension\n│   ├── rot13.c\n│   ├── rot13.h.in\n|   |── fiddle.make               # Overrides the default make file to add the extension to the fiddle\n│   └── sqlite_wasm_extra_init.c  # Required for WASM build\n├── tests/                        # Contains the test suite for the SQLite extension\n│   ├── test_loadable.sql         # Contains the SQL test cases for the loadable module\n│   └── test_rot13.py             # Contains the Python test cases for the rot13 virtual table module\n├── build/                        # Intermediate build files\n├── build_release/                # Intermediate build files when making the release targets\n├── vendor/\n│   └── sqlite/                   # Git submodule for the SQLite library\n├── dist/\n│   ├── debug/                    # Debug build artifacts\n│   └── release/                  # Release build artifacts\n├── scripts/\n|   └── rename_wheels.py\n├── bindings/                     # Bindings for other builds\n│   └── python/\n├── CMakeLists.txt\n├── Makefile\n└── README.md\n```\n\nRunning `make python` will generate an installable wheels in `dist/debug/wheels`.\n\nThe output of `make wasm` is located at `dist/debug/wasm` and includes a fiddle with the extension built-in. Test it out by running `python -m http.server` and browsing the directory content.\n\n## Makefile\n\nThe Makefile in this repository contains the following targets:\n\n- `loadable`: builds a loadable version of the extension. The module will be located in `dist/debug`, with file extensions `.dylib`, `.so`, or `.dll` depending on your operating system\n- `loadable-release`: release version of the loadable module located in `dist/release`\n- `static`: builds the static version of the extension. `.a` and `.h` files are located in `dist/debug` and can be used to statically link with other projects.\n- `static-release`: release version of the static library located in `dist/release`\n- `wasm`: builds the WebAssembly module including SQLite fiddle. Built files and demos are copied to `dist/debug/wasm`.\n- `wasm-release`: builds the WebAssembly module for release. Built files are copied to `dist/release/wasm`.\n- `python`: builds the Python wheels in debug mode. Built files are located at `dist/debug/wheels`.\n- `python-release`: builds the Python wheels for release. Built files are located at `dist/release/wheels`.\n- `python-versions`: updates the version file for the Python package\n- `test-loadable`: test the Python loadable module\n- `test-python`: test the Python package (requires installation)\n- `test`: runs both the loadable module test and the Python package test\n- `clean`: removes all dist files\n\n[SQLite]: https://sqlite.org/index.html\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimlrx%2Fsqlite-extension-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimlrx%2Fsqlite-extension-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimlrx%2Fsqlite-extension-template/lists"}