Oxid SQL
Native SQL diagnostics and typed Python generation for
SQLite .sq files. No Java, Gradle, Python, Cargo or database server
is required to use the extension. The compiler is bundled and works offline.
Use
Open a .sq file containing a schema and labelled queries. The .sq files of one folder
are one database: a file may use tables and views declared in its siblings.
CREATE TABLE Dog (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
born INTEGER NOT NULL
);
insert:
INSERT INTO Dog (name, born) VALUES (?, ?) RETURNING *;
selectNames:
SELECT name FROM Dog WHERE born < :year ORDER BY name;
Errors appear in Problems as you type, including unsaved changes. The editor offers
schema-aware completion, column/type hover, definitions and a document outline.
Choose Oxid SQL: Generate Python in
the Command Palette or editor context menu. Generated code opens in a separate unsaved
editor; save it wherever your build needs it. Existing files are never overwritten.
It uses standard-library sqlite3, returns checked typed rows
and leaves transactions to your application. Columns declared with an adapter
(kind TEXT AS pkg.Kind) need a Python type: set sql.pythonAdapters
(e.g. {"pkg.Kind": "kinds.Kind"});
an unmapped type is reported as a generation error.
Supported SQL
The compiler supports SQLite schemas, views, migrations, joins, compound selects, CTEs,
aggregates, expressions, collection binds and labelled SELECT, INSERT, UPDATE and DELETE
statements. -- @crud, -- @nested, -- @map, -- @keyset and -- @relation annotations
generate common higher-level APIs. Named :name, anonymous ? and repeated binds are supported;
types and nullability are preserved.
Schemas are shared by the .sq and .sqm files of one folder, not across folders. SQL outside
the compiler's documented SQLite dialect produces an explicit diagnostic. This is not a general
SQL client: it does not connect to or execute queries against your databases.
Install the Marketplace build matching your platform. The bundled native compiler runs
locally. The extension sends no SQL, source code or telemetry over the network, and does
not download executables. sql.compilerPath optionally selects another compatible
absolute executable path in a trusted workspace; otherwise the bundled compiler runs.
Problems and support: support@optersoft.com.