Skip to content

Join tables from two saved connections in one query #3623

Open

Description

@datlechin

Problem

A query runs on one connection. Joining orders on a PostgreSQL server with customers on a MySQL server means exporting one side, importing it into the other, and joining there. Transfer To… (features/import-export.mdx, Transfer to another connection) copies rows from one connection into another; it does not query across them.

DuckDB can already do the join: its postgres, mysql and sqlite extensions attach those databases into one session. The DuckDB plugin keeps runtime extension autoloading on (apple/Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift:462, and the reason in apple/scripts/duckdb-macos-extensions.cmake), so a user can type ATTACH 'host=… password=…' AS pg (TYPE postgres) into a DuckDB tab today. That puts the password in the query text and in query history, ignores the SSH tunnel and TLS settings the saved connection already has, and has to be retyped after every reconnect, since DuckDB does not persist attachments (databases/duckdb.mdx).

Proposed solution

  • A combined query workspace: pick two or more saved connections (PostgreSQL, MySQL and MariaDB, SQLite, DuckDB files), and TablePro attaches each into an in-memory DuckDB under a name the user can change, defaulting to the connection's name.
  • Credentials come from where the connection already keeps them and reach DuckDB as temporary secrets, never as SQL text, so nothing secret lands in the editor, history or logs.
  • Each attachment goes through the connection's own SSH tunnel and TLS settings, and is attached READ_ONLY unless the user turns writes on for it. A connection whose Safe Mode asks for confirmation stays read-only.
  • The sidebar lists each attached database with its tables, and completion knows pg.public.orders.
  • The set of connections is saved, so reopening the workspace attaches them again.
  • Ships as a module, off by default (apple/AGENTS.md, Scope), since it needs the DuckDB plugin and downloads DuckDB extensions on first use.

Done means one SELECT joins a table from a saved PostgreSQL connection with a table from a saved MySQL connection, over their SSH tunnels, without a password typed anywhere.

Alternatives considered

Export one side and import it into the other, or a DuckDB tab with ATTACH statements that carry the password in plain text.

Platform

macOS

Related database type

N/A / General

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions