Skip to main content
Most database vendors provide their own SQL command line tools, but they vary significantly in features and usage. To simplify working with multiple databases, Wirekite provides Wiretalk - a unified SQL command line tool that works consistently across all supported databases. Wiretalk uses the same DSN/URL connection files as other Wirekite tools. If you can connect to a database using Wiretalk, the same connection file will work with other Wirekite components.

Supported Databases

Wiretalk supports all Wirekite source and target databases:
DatabaseType Flag
PostgreSQLpostgres or postgresql
MySQLmysql
MariaDBmariadb
SQL Serversqlserver
Oracleoracle
Snowflakesnowflake
Fireboltfirebolt
Google BigQuerybigquery
Google Cloud Spannerspanner
Databricksdatabricks
SingleStoresinglestore

Command Line Usage

wiretalk -d <dbtype> -c <connection-file>
Or with a direct connection string:
wiretalk -d <dbtype> -dsn "<connection-string>"

Required Flags

FlagDescription
-dDatabase type (required) - see supported databases above
-cPath to file containing the connection string
-dsnConnection string provided directly (alternative to -c)
Note: Either -c or -dsn must be provided.

Optional Flags

FlagDescription
-quietSuppress prompts, print only row numbers and column names
-silentPrint only query results (no metadata)
-csvOutput results in CSV format with headers
-jsonOutput per-statement JSON results (for programmatic integration)

Interactive Mode

When run interactively (connected to a terminal), Wiretalk provides a prompt-based interface with command history.

Example Session

$ wiretalk -d firebolt -c fi_url.txt
firebolt instance connect successful
=> create table example (a int, b int);
ok
=> insert into example values (1,1),(2,2),(3,3);
ok
=> select * from example;
1: a: 1
1: b: 1
2: a: 2
2: b: 2
3: a: 3
3: b: 3
=> \d csv
display type set to csv
=> select * from example;
'a','b'
'1','1'
'2','2'
'3','3'
=> <ctrl>-D
bye

Escape Commands

Wiretalk provides several escape commands for controlling output and behavior:
CommandDescription
\hDisplay help information
\i <filename>Load and execute SQL statements from a file
\o [filename]Redirect output to a file; \o alone disables file output
\d csv|listChange display format (default: list)
\p <num>Set number of rows per page; 0 disables paging
\r true|falseShow or hide row numbers
\tToggle elapsed time display
\DPrint current display settings
\c <enc> <sep> <row> <hdr>Configure CSV format parameters

CSV Format Configuration

The \c command configures CSV output format with four parameters:
\c <value-enclose> <column-separator> <row-terminator> <show-header>
Available separator tokens:
  • QUOTE - single quote (')
  • DOUBLEQUOTE - double quote (")
  • COMMA - comma (,)
  • SPACE - space character
  • TAB - tab character
  • PIPE - pipe (|)
  • NONE - no character
  • NEWLINE - newline (\n)
  • CRLF - carriage return + newline (\r\n)
  • Any other literal character
Example:
=> \c DOUBLEQUOTE COMMA NEWLINE true

Non-Interactive Mode

Wiretalk can execute SQL from files or stdin in non-interactive mode:
# From a file
wiretalk -d postgres -c pg_conn.txt < schema.sql

# Piped input
cat queries.sql | wiretalk -d mysql -c mysql_conn.txt -quiet

JSON Output Mode

For programmatic integration, use -json to get structured output:
echo "CREATE TABLE test (id INT); INSERT INTO test VALUES (1);" | wiretalk -d postgres -c pg_conn.txt -json
Output:
{"index":1,"sql":"CREATE TABLE test (id INT)","status":"OK","lineNum":1}
{"index":2,"sql":"INSERT INTO test VALUES (1)","status":"OK","lineNum":1}
Each statement produces a JSON object with:
  • index - statement number (1-based)
  • sql - the executed SQL
  • status - OK or FAILED
  • error - error message (only if status is FAILED)
  • lineNum - line number in input

Database-Specific Features

Oracle PL/SQL Blocks

Oracle PL/SQL blocks (starting with BEGIN or DECLARE) are terminated by a / on its own line:
BEGIN
  DBMS_OUTPUT.PUT_LINE('Hello World');
END;
/

Google Cloud Spanner Batch DDL

Spanner requires DDL statements to be batched together. Wiretalk supports this with special commands:
START BATCH DDL;
CREATE TABLE users (id INT64, name STRING(100)) PRIMARY KEY (id);
CREATE TABLE orders (id INT64, user_id INT64) PRIMARY KEY (id);
RUN BATCH;

Notes

  • Command history is saved to ~/.linerhistory
  • Multi-line SQL statements are supported - statements are executed when a semicolon is encountered
  • For PostgreSQL, sslmode=disable is automatically added if not specified
  • SQL Server PRINT output from stored procedures is captured and displayed