godot-sqlite: Setup, Bindings, and Godot Database Use
GDExtension wrapper for SQLite (Godot 4.x+)
At a glance
- What is it?
- godot-sqlite is a C++ GDExtension wrapper that adds SQLite databases to Godot 4.x projects without rebuilding Godot. It supports local files, parameter binding, read-only packaged databases, and several export targets, but its API remains closely tied to raw SQL.
- Who is it for?
- Godot developers should adopt godot-sqlite when a Godot 4.x game or application needs a local SQLite file and accepts raw SQL. Projects that require an ORM, hidden SQLite configuration, or a server database should choose another approach.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 34 days ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 21, 2026, and from our analysis. They are not legal advice.
Editorial analysis
godot-sqlite’s Role in Godot 4.x Projects
godot-sqlite solves a specific gap between Godot and SQLite. Godot applications often need persistent local data, but the editor does not provide SQLite as a database service in this project’s model. The repository supplies a wrapper implemented as a C++ GDExtension, making SQLite available to Godot 4.x while avoiding a custom engine rebuild.
It is aimed at Godot developers who are comfortable writing SQL. The interface exposes raw SQL statements, result arrays, connection methods, and SQLite settings rather than presenting a higher-level object mapper. That makes the extension suitable for save data, inventories, local catalogs, progression records, or other structured information that benefits from relational queries. The repository also includes a `demo` project and a `data_to_be_packaged.db` file, so the intended workflow includes opening an actual database from a Godot project.
The extension does not remove database design responsibilities. Developers still need to choose tables, relationships, constraints, indexes, and migration steps. They also need to decide whether foreign-key enforcement is appropriate for a given database. That work belongs outside the plugin, and the documentation does not describe a schema migration system.
How godot-sqlite Connects Godot to SQLite
The data path is direct. A Godot-side database object receives a path, opens an SQLite connection with `open_db()`, and accepts SQL through `query()`. SQLite executes the statement, the extension stores the latest results, and the application reads those values from `query_result` or `query_result_by_reference`.
Those result properties have different lifetimes. `query_result` contains the latest rows by value, so a loop can retain an earlier result while later queries run. `query_result_by_reference` is cleared and repopulated after each query. This distinction matters when a script performs several statements and then processes an earlier result set.
The path property defaults to `"default"`. Unless another extension is present, the extension appends `default_extension`, whose default value is `"db"`. Paths can use Godot’s `res://` and `user://` schemes. If the named database does not exist, opening it creates one at the supplied path. For writable save data, `user://` is the documented project path scheme, while `res://` also provides access to resources inside the project.
SQLite error text is available through `error_message`. The README describes an empty value as the successful case. After insertion, `last_insert_rowid` exposes `sqlite3_last_insert_rowid()` and rejects direct modification. This lets a script retrieve SQLite’s generated row identifier without issuing a second lookup query.
Installing godot-sqlite and Enabling the Plugin
The supported installation path does not require compiling Godot. In the editor, select the Asset Library, search for `godot-sqlite`, download the listed asset, and complete the two installation confirmation steps. Then open `Project Settings/Plugins` and activate the plugin.
A manual installation is also possible. Download the build files from the repository’s releases page, extract them, and place them where Godot can load `gdsqlite.gdextension` in the project’s `res://` environment. The README does not give a shell command for extraction or a specific directory layout, so the packaged demo project is the more concrete manual reference.
The repository publishes platform builds for macOS, Linux, Windows, Android arm64, iOS arm64, and HTML5. The README warns that HTML5 stability depends on the browser. A listed platform is therefore a packaging target, not a guarantee that every export route has identical behavior. Platform-specific database placement and file access still need verification in the application’s export configuration.
Running a First Parameterized Query
The README uses a `company` table with `name` and `age` columns for its binding example. Set the database path before opening the connection, configure any required SQLite options, then use `query_with_bindings()` for a statement containing positional placeholders.
The documented example is:
var column_name : String = "name";
var query_string : String = "SELECT %s FROM company WHERE age < ?;" % [column_name]
var param_bindings : Array = [24]
var success = db.query_with_bindings(query_string, param_bindings)Here, `db` represents the opened database object in the example. The statement selects a column and binds `24` to `?`, which SQLite treats as a value rather than query syntax. After success, inspect `query_result` for the returned rows and `error_message` for SQLite’s human-readable error text.
The extension also documents `query_with_named_bindings(String query_string, Dictionary param_bindings)`. Named bindings accept `String` or `StringName` keys, and the repository added this capability in release `v4.7`. Bindings are required for inserting or selecting `PackedByteArray` values as SQLite BLOBs. For ordinary values, the README describes bindings as optional, though using them avoids constructing untrusted values into SQL text.
SQLite placeholders cannot bind identifiers such as column names. If a column name must be dynamic, the documented approach inserts that identifier into `query_string` directly. That is a real boundary: the binding methods protect value parameters, not SQL structure.
Read-Only Packaging and Query Logging Trade-offs
Setting `read_only` to `true` changes how the extension opens the database. It uses a custom SQLite VFS that routes file handling through Godot’s API. This allows a database packaged inside a PCK to be opened without requiring an ordinary writable filesystem location.
That option has a clear use case but should not be treated as a general performance switch. It is intended for packaged, read-only database files. Applications that create or modify records still need a writable database path, and the README does not document automatic copying from a packaged read-only file into `user://`.
`foreign_keys` defaults to `false`. SQLite foreign-key behavior must therefore be enabled explicitly when the application expects constraints to be enforced. This setting changes database semantics, so enabling it can make previously accepted operations fail.
Logging is controlled by `verbosity_level`. `QUIET` prints nothing, `NORMAL` prints essential information, `VERBOSE` adds more output, and `VERY_VERBOSE` behaves the same as `VERBOSE`. The README warns that verbose levels can considerably slow queries because of excessive logging. Production builds may need quieter output, while development sessions can use more logging to diagnose faulty statements.
Release Compatibility and MIT Upgrade Boundaries
The repository is not archived, and its last push was on 2026-09-19. Recent releases show repeated compatibility work: `v4.7` added named bindings, `v4.8` updated to Godot 4.6.3, and `v4.9` updated to Godot 4.7.1. These dates confirm recent repository activity, but they do not prove compatibility with every Godot release or export target.
The extension is explicitly tied to the engine’s GDExtension interface. Upgrading Godot can therefore require choosing a matching godot-sqlite build and retesting database operations. The README also separates compatibility by branch: the current branch targets Godot 4.x, while Godot 3.x support lives on the `godot-3.x` branch. A project still on Godot 3 cannot simply assume that the current build applies.
The repository uses the MIT license. Its `LICENSE.md` is the controlling source for permissions and conditions. The license does not change the application’s responsibility for SQL correctness, exported file placement, schema compatibility, or data loss. Upgrades should be treated as interface changes because result handling, named bindings, VFS behavior, and engine loading can all affect an existing game.
Why Raw SQLite Differs from an ORM or Server Database
The main alternative is an ORM or higher-level database layer. Such a layer usually maps Godot objects or records to tables and supplies schema and query abstractions. godot-sqlite takes the opposite approach: its public methods accept raw SQL, and its properties expose SQLite-oriented results and settings.
This difference changes both control and responsibility. Direct SQL supports transactions, joins, aggregate queries, and schema-specific operations without waiting for an ORM to model them. The trade-off is that scripts own SQL construction, error handling, and schema discipline. There is no documented migration generator or record lifecycle system.
A client-server database is another alternative when data must be shared across devices or users. godot-sqlite is a local SQLite wrapper, and the documentation says nothing about network synchronization, authentication, conflict resolution, or a database server protocol. It should not be selected merely because SQLite is familiar if the real requirement is shared authoritative data.
Editorial conclusion
Godot developers should adopt godot-sqlite when a Godot 4.x game or application needs a local SQLite file and accepts raw SQL. Projects that require an ORM, hidden SQLite configuration, or a server database should choose another approach. Before adoption, verify the release against the project’s Godot version, confirm the intended export platform is supported, and test database deployment rules for that platform.
Frequently asked questions
Does godot-sqlite require rebuilding Godot?
No. The README says to install the prebuilt extension through the Godot Asset Library or manually extract release build files. Godot must be able to load `gdsqlite.gdextension` from the project environment.
Which operating systems and platforms does godot-sqlite support?
The README lists macOS, Linux, Windows, Android arm64, iOS arm64, and HTML5. For HTML5, the documentation says stability depends on the browser.
How does godot-sqlite bind SQL values?
`query_with_bindings()` accepts an array for nameless placeholders, while `query_with_named_bindings()` accepts a dictionary with `String` or `StringName` keys. Bindings also provide the documented way to handle `PackedByteArray` BLOBs.
Can a godot-sqlite database be packaged inside a PCK?
Yes, when `read_only` is enabled. The extension uses a custom VFS to perform file handling through the Godot API, allowing read-only databases packaged inside a PCK.
Can godot-sqlite bind dynamic column names?
No. SQLite placeholders bind values, not identifiers. The README says a required dynamic column name must be inserted directly into the SQL string.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/2shady4u-godot-sqlite)Was this useful?