npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@remix-run/data-table-postgres

v0.5.0

Published

PostgreSQL database implementation for remix/data-table

Readme

data-table-postgres

PostgreSQL database driver for remix/data-table, backed by pg.

Features

  • Native pg Integration: Creates a pool from pg configuration or uses an existing pool or client
  • Full data-table API Support: Queries, relations, writes, and transactions
  • PostgreSQL Compiler: SQL compilation is handled automatically for PostgreSQL
  • Multi-Statement Migrations: executeScript() runs up.sql / down.sql files natively via pg
  • Postgres Capabilities Enabled By Default:
    • returning: true
    • savepoints: true
    • upsert: true
    • transactionalDdl: true
    • migrationLock: true

Installation

npm i remix pg

Usage

import { createPostgresDatabase } from 'remix/data-table/postgres'

let db = createPostgresDatabase({
  connectionString: process.env.DATABASE_URL,
})

Use db.query(...), relation loading, and transactions from remix/data-table. Import any driver-specific types you need directly from pg.

Config-backed databases support db.wipe() and db.reset(). Call await db.close() during application shutdown to close the internally created pool. You may pass an existing pg pool or client when your application owns the driver lifecycle; db.close() leaves supplied clients alone, and destructive lifecycle methods are unavailable in that mode. db.wipe() requires a database name resolvable from the connection config (database, the path of connectionString, or the PGDATABASE environment variable) and throws when none is present.

Migration runs reserve one connection for the PostgreSQL advisory lock, migration SQL, and journal updates. Lock acquisition waits up to 60 seconds (via lock_timeout) and fails with an error instead of blocking forever. After a successful run the connection is unlocked and returned to the pool; if the migration or unlock fails, the reserved connection is destroyed instead of being reused, so a dirty session can never leak back into the pool. Nested migration lock acquisition throws instead of deadlocking.

Database Capabilities

data-table-postgres reports this capability set by default:

  • returning: true
  • savepoints: true
  • upsert: true
  • transactionalDdl: true
  • migrationLock: true

Advanced Usage

Transaction Options

Transaction options are passed through to PostgreSQL as hints.

await db.transaction(async (txDb) => txDb.exec('select 1'), {
  isolationLevel: 'serializable',
  readOnly: false,
})

Running integration tests locally

To start a local Postgres container matching CI:

podman run --name postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=remix \
  -p 5432:5432 \
  -d postgres:16

Then run:

REMIX_DATA_TABLE_POSTGRES_TEST_URL=postgres://postgres:[email protected]:5432/remix \
pnpm test src/lib/driver.integration.test.ts

Remove the container when you are done:

podman rm -f postgres

Related Packages

License

See LICENSE