Skip to main content

Datatables

The wmill datatable commands let you query and manage data tables from the CLI. You can list available datatables, run SQL queries, or start an interactive PostgreSQL session.

Listing datatables

List all datatables in the current workspace.

wmill datatable list [options]

Options

OptionDescription
--jsonOutput as JSON (for piping to jq)

Example

wmill datatable list

Output:

+------------+---------------+---------------+
| Name | Resource Type | Resource Path |
+------------+---------------+---------------+
| main | postgresql | f/db/main |
| analytics | postgresql | f/db/stats |
+------------+---------------+---------------+

Running a query

Execute a SQL query against a datatable and display results.

wmill datatable run [options] <sql>

Arguments

ArgumentDescription
sqlThe SQL query to execute

Options

OptionParametersDescription
-n, --namenameDatatable name to query (default: main)
-s, --silentOutput only the final result as JSON (for scripting)

Examples

  1. Basic query:
wmill datatable run "SELECT * FROM users LIMIT 10"
  1. Query a specific datatable:
wmill datatable run -n analytics "SELECT COUNT(*) as count FROM events"
  1. Silent mode for scripting:
wmill datatable run -s "SELECT version()" | jq '.version'

Starting a PostgreSQL proxy server

Start a PostgreSQL wire-protocol proxy that serves all datatables. This allows any Postgres-compatible client (psql, DBeaver, pgAdmin, etc.) to connect and query your datatables.

wmill datatable serve [options]

Options

OptionParametersDescription
--portportPort to listen on (default: first available 5433-5500)
--hosthostBind address (default: 127.0.0.1)
--passwordpasswordConnection password (default: randomly generated)

Behavior

  • Implements the PostgreSQL wire protocol (read-only queries only)
  • Each datatable appears as a separate database in the connection
  • Supports prepared statements and parameterized queries
  • Emulates Postgres system tables (like pg_database) for tool compatibility

Example

wmill datatable serve

Output:

Serving datatables on 127.0.0.1:5433 via Postgres wire protocol

Available datatables:
psql 'postgresql://wmill:[email protected]:5433/main'
psql 'postgresql://wmill:[email protected]:5433/analytics'

Press Ctrl+C to stop.

Connect with any Postgres client using the connection string shown.

Interactive psql session

Start a proxy server and launch an interactive psql session connected to it.

wmill datatable psql [options]

Options

OptionParametersDescription
-n, --namenameDatatable to connect to (default: main)
--portportPort for the proxy (default: first available 5433-5500)
--hosthostBind address for the proxy (default: 127.0.0.1)
--passwordpasswordConnection password (default: randomly generated)

Prerequisites

The psql client must be installed:

  • Linux: apt install postgresql-client
  • macOS: brew install libpq

Examples

  1. Interactive session with the default datatable:
wmill datatable psql
  1. Connect to a specific datatable:
wmill datatable psql -n analytics

Summary

CommandPurpose
listList all datatables in the workspace
runExecute a single SQL query
serveStart a Postgres proxy for external clients
psqlLaunch an interactive psql session