Node.js - Drizzle support
Introduction
Drizzle is a lightweight, TypeScript-first ORM built around plain SQL-like, fluent query builders, for PostgreSQL, MySQL, SQLite, Microsoft SQL Server, SingleStore and CockroachDB
- see https://orm.drizzle.team/ for more information.
Objects
This extension creates the entity and entity operation objects:
- a
NodeJS Entityobject when a table is defined using one ofpgTable,mysqlTable,sqliteTable,mssqlTable,singlestoreTableorcockroachTable; - a
NodeJS Entity Operationobject when one of the supported Drizzle APIs is used on a Drizzle client and linked to one of the entities.
| Icon | Description |
|---|---|
![]() |
NodeJS Entity |
![]() |
NodeJS Entity Operation |
Supported persistence SQL databases
Supported operations
| Entity Operation | Supported APIs |
|---|---|
| Insert |
|
| Update |
|
| Delete |
|
| Select |
|
The table argument of these APIs is resolved back to its table definition even when it is a variable,
a namespace/barrel-exported reference (e.g. import * as schema from './schema'), or a table wrapped
with alias() - and regardless of whether the table definition or the API call is analyzed first.
Supported links
| Link Type | Caller type | Callee type | Comment |
|---|---|---|---|
| callLink |
|
|
|
| useInsertLink |
|
|
Created by SQL Analyzer when DDL source files are analyzed or by Missing tables and procedures for Node.js when the object is not analyzed. |
| useUpdateLink |
|
|
Created by SQL Analyzer when DDL source files are analyzed or by Missing tables and procedures for Node.js when the object is not analyzed. |
| useDeleteLink |
|
|
Created by SQL Analyzer when DDL source files are analyzed or by Missing tables and procedures for Node.js when the object is not analyzed. |
| useSelectLink |
|
|
Created by SQL Analyzer when DDL source files are analyzed or by Missing tables and procedures for Node.js when the object is not analyzed. |
Example
Take the following code:
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
import { eq } from 'drizzle-orm';
const usersTable = sqliteTable('users_table', {
id: integer('id').primaryKey(),
name: text('name').notNull(),
});
const client = createClient({ url: 'file:local.db' });
const db = drizzle(client);
async function main() {
await db.insert(usersTable).values({ name: 'Some Name' });
await db.select().from(usersTable);
await db.update(usersTable).set({ name: 'A name' }).where(eq(usersTable.id, 1));
await db.delete(usersTable).where(eq(usersTable.name, 'Another name'));
}
In this example, one ‘NodeJS Entity’ object (‘users_table’) and four ‘NodeJS Entity Operation’ objects (Insert, Select, Update, Delete) are created, each with a callLink from the ‘main’ function. The SQL Analyzer or Missing tables and procedures for Node.js then links these entity operations with the corresponding missing table ‘users_table’:

Known limitations
The following features are not supported:
- raw SQL queries (e.g.
db.execute(sql\…`)`) do not create ‘TypeScript SQL Query’ objects - resolving the table used inside a
db.transaction(async (tx) => { ... })callback

