Skip to content

Points to Note for Each Dialect (pg / mysql / sqlite / D1) ​

Since Kosame is based on Drizzle, it cannot fully account for differences between databases. This page covers the points to note for each one.

Transactions ​

DialectDetails
PostgreSQLdb.transaction()
MySQLdb.transaction()
SQLite (better-sqlite3/bun:sqlite)Manually issue raw SQL BEGIN/COMMIT/ROLLBACK (use SAVEPOINT for nesting)
D1db.transaction() (It has not been verified whether D1 accepts internal BEGIN/COMMIT statements)

Since @libsql/client is an asynchronous driver, it delegates to db.transaction(). For details, see Transactions.

context.raw and txContext.raw ​

DialectDetails
PostgreSQLSeparate connection
MySQLSeparate connection
SQLiteSingle connection (txContext.raw and context.raw are the same object)
D1Unverified

For more details, see Escape Hatch.

Retrieving Rows After an INSERT ​

DialectDetails
PostgreSQL.returning()
MySQLUse $returningId() to retrieve the primary key and perform a new SELECT
SQLite.returning()
D1.returning() (same as SQLite)

In MySQL, since rows cannot be retrieved after an INSERT on tables without a primary key, add() cannot be used.

Type of deletedAtColumn() ​

DialectDetails
PostgreSQLtimestamp
MySQLdatetime
SQLiteinteger (timestamp mode)
D1Same as SQLite

import ​

DialectDetails
PostgreSQLkosame/pg
MySQLkosame/mysql
SQLitekosame/sqlite
D1kosame/sqlite