Documentation Index
Fetch the complete documentation index at: https://docs.wirekite.io/llms.txt
Use this file to discover all available pages before exploring further.
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:
| Database | Type Flag |
|---|
| PostgreSQL | postgres or postgresql |
| MySQL | mysql |
| MariaDB | mariadb |
| SQL Server | sqlserver |
| Oracle | oracle |
| Snowflake | snowflake |
| Firebolt | firebolt |
| Google BigQuery | bigquery |
| Google Cloud Spanner | spanner |
| Databricks | databricks |
| SingleStore | singlestore |
Command Line Usage
wiretalk -d <dbtype> -c <connection-file>
Or with a direct connection string:
wiretalk -d <dbtype> -dsn "<connection-string>"
Required Flags
| Flag | Description |
|---|
-d | Database type (required) - see supported databases above |
-c | Path to file containing the connection string |
-dsn | Connection string provided directly (alternative to -c) |
Note: Either -c or -dsn must be provided.
Optional Flags
| Flag | Description |
|---|
-quiet | Suppress prompts, print only row numbers and column names |
-silent | Print only query results (no metadata) |
-csv | Output results in CSV format with headers |
-json | Output per-statement JSON results (for programmatic integration) |
-credfile <path> | Path to a GCP service account JSON file. Required for Spanner and BigQuery connections |
-ignore-errors | Continue executing remaining SQL statements even if one fails. Without this flag, execution stops on the first error |
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:
| Command | Description |
|---|
\h | Display 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|list | Change display format (default: list) |
\p <num> | Set number of rows per page; 0 disables paging |
\r true|false | Show or hide row numbers |
\t | Toggle elapsed time display |
\D | Print current display settings |
\c <enc> <sep> <row> <hdr> | Configure CSV format parameters |
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