Skip to content

A tablepro query command that prints results for shell scripts #3617

Closed

Description

@datlechin

Problem

The tablepro command opens things in the app and prints nothing. It is a script whose whole body is exec open -b com.TablePro "$@" (apple/TablePro/CLI/tablepro, integrations/terminal.mdx:21-22).

A shell script can run a statement today only through AppleScript's run query, which takes a row limit and a timeout and respects the connection's External Clients level and Safe Mode (developers/applescript.mdx:5-45, :128-142). From a shell that means:

  • osascript with nested quoting, and results as AppleScript lists rather than CSV or JSON.
  • A two-minute AppleEvent limit unless the call is wrapped in with timeout, and at most 10,000 rows.
  • Automation permission granted to the sending app, such as Terminal, which then reads every connection that is not Blocked (developers/applescript.mdx:37-39).

The bundled tablepro-mcp bridge serves MCP clients, not shell pipelines (features/mcp.mdx:19-23).

Proposed solution

  • tablepro query --connection <name or id> [--database <db>] [--schema <schema>] [--format csv|tsv|json|jsonl|table] [--limit N] [--timeout S] [--read-only], taking the SQL as an argument, from -f <file>, or on stdin.
  • Rows go to stdout, errors to stderr, and the exit code says what happened: 0 success, 1 query error, 2 usage error, 3 refused by policy, 4 timed out.
  • The same gates as AppleScript and MCP: the External Clients level, Safe Mode, the execution audit log, and the history drawer under Command Line. --read-only refuses any statement that is not a read, even on a Read & Write connection. A flag can lower what the connection allows, never raise it.
  • tablepro connections --format json lists names, ids and types, never secrets.
  • The command talks to the running app over the local channel the MCP bridge already uses, and starts TablePro in the background with no window when it is not running, as the bridge does. It pairs once, like an MCP client, so revoking it in Settings stops it.
  • --limit defaults to 500, and rows stream as they arrive, so a large result does not wait to be held in full.

Done when: tablepro query --connection Staging --format csv "SELECT 1 AS n" prints a header and one row and exits 0, a write with --read-only exits 3 without reaching the server, and --timeout 5 on a 10-second query exits 4.

Alternatives considered

osascript -e 'tell application "TablePro" to run query ...', or the database's own CLI with credentials kept outside TablePro.

Platform

macOS

Related database type

N/A / General

Activity

  1. added
    enhancement
    platform-macos
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplatform-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions