new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Drizzle · MySQL · all subjects

drivers

77 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

Expo SQLite driver basic usage

After setting up the Expo SQLite driver, queries can be executed in multiple ways: await db.select().from(...), db.select().from(...).then(...), or db.select().from(...).all().

Expo SQLite driver full code example

import { drizzle } from "drizzle-orm/expo-sqlite"; import { openDatabaseSync } from "expo-sqlite"; const expoDb = openDatabaseSync("db.db"); const db = drizzle(expoDb); await db.select().from(...)...; // or db.select().from(...).then(...); // or db.select().from(...).all();

SQLite Proxy relational queries support

SQLite Proxy driver now supports relational query syntax including .query.findFirst() and .query.findMany() methods, allowing you to use the same relational query patterns with the SQLite proxy driver as with other drivers.

SQLite Proxy batch requests support

SQLite Proxy driver supports batch requests through a batch callback function. When creating a drizzle instance with sqlite-proxy, pass a second callback parameter that handles batch queries. The callback receives an array of query objects with sql, params, and method properties. It should return an array of raw values (array within array) in the same order as the queries were sent.

SQLite Proxy batch callback setup example

Example showing how to configure SQLite Proxy batch support: ```ts import { drizzle } from 'drizzle-orm/sqlite-proxy'; type ResponseType = { rows: any[][] | any[] }[]; const db = drizzle( async (sql, params, method) => { // single query logic }, // batch callback async ( queries: { sql: string; params: any[]; method: 'all' | 'run' | 'get' | 'values'; }[], ) => { try { const result: ResponseType = await axios.post( 'http://localhost:3000/batch', { queries }, ); return result; } catch (e: any) { console.error('Error from sqlite proxy server:', e); throw e; } }, ); ``` After setup, use db.batch([]) to proxy all queries to the server.

OP-SQLite driver initialization example

Example showing how to initialize OP-SQLite with Drizzle: import { open } from '@op-engineering/op-sqlite'; import { drizzle } from 'drizzle-orm/op-sqlite'; const opsqlite = open({ name: 'myDB', }); const db = drizzle(opsqlite); await db.select().from(users);

Xata database access options

Drizzle ORM supports three ways to access a Xata Postgres database: the native xata-http driver (drizzle-orm/xata package), the postgres driver, and the pg driver.

PGlite driver import and basic usage

To use PGlite with Drizzle, import PGlite from '@electric-sql/pglite' and drizzle from 'drizzle-orm/pglite'. Create a new PGlite instance and pass it to the drizzle() function. Example: const client = new PGlite(); const db = drizzle(client); await db.select().from(users);

Vercel Postgres is a supported driver

Vercel Postgres is a supported database driver for use with Drizzle, with documentation available for getting started.

Neon is a supported driver

Neon is a supported database driver for use with Drizzle, with documentation available for getting started.

AWS Data API driver multiple issues fixed

In Drizzle ORM v0.30.8, multiple issues with the AWS Data API driver were fixed, including problems with inserting and updating array values.

TiDB Cloud Serverless driver support in DrizzleORM v0.31.2

DrizzleORM v0.31.2 added support for TiDB Cloud Serverless driver. To use it, import the connect function from @tidbcloud/serverless and the drizzle function from drizzle-orm/tidb-serverless. Create a client by calling connect with a url option, then initialize the database with drizzle(client).

TiDB Cloud Serverless driver example

import { connect } from '@tidbcloud/serverless'; import { drizzle } from 'drizzle-orm/tidb-serverless'; const client = connect({ url: '...' }); const db = drizzle(client); await db.select().from(...);

MSSQL dialect support in Drizzle

Drizzle now supports MSSQL in drizzle-orm, drizzle-kit, and drizzle-seed packages. It supports most column types, query builder capabilities, and migration strategies. RQBv2 (Relational Query Builder v2) is not yet supported for MSSQL. Use import { drizzle } from 'drizzle-orm/node-mssql' to connect.

CockroachDB dialect support in Drizzle

Drizzle now supports CockroachDB in drizzle-orm, drizzle-kit, and drizzle-seed packages. It supports most column types, query builder capabilities, and migration strategies. RQBv2 is not yet supported for CockroachDB. Use import { drizzle } from 'drizzle-orm/cockroach' to connect. The underlying driver is node-postgres (pg).

Fixed pg mappers for Date instances in PostgreSQL responses

v1.0.0-beta.2 fixed pg mappers not handling Date instances in bun-sql:postgresql driver responses for date and timestamp types (fixes GitHub issue #4493).

CockroachDB connection with options

To connect to CockroachDB with specific options in Drizzle: import { drizzle } from 'drizzle-orm/cockroach'; const db = drizzle({ connection: { connectionString: process.env.DATABASE_URL, ssl: true } });

Give your agent this brain