omnisql is the client-side SQL console that displays query results for SQL statements you submit to the OmniSciDB Server.
omnisql [<database>] [<options>]
<database> is the name of the database to connect to. The default database name is omnisci.
Print help messages.
Print omnisql version number.
Do not print query result header.
Print timing information.
Field delimiter in row output.
Database name (default is omnisci).
Path to trusted server certificate. Initiates an encrypted connection.
Port number. Default is 6274.
Use HTTP transport.
Use HTTPS transport.
Do not verify SSL certificate validity.
Do not print result headers or connection strings.
After starting omnisql, you can enter SQL queries or backslash commands from the command line.
The OmniSci server has a default one hour timeout on individual HTTP requests, including those made from omnisql, when using Thrift HTTP transport. If your queries are expected to exceed the timeout, use either the default omnisql TCP transport or increase the timeout using the
If the connection to the server is lost, omnisql automatically attempts to reconnect.
You can use the backslash commands listed in the table below for a variety of tasks beyond SQL queries.
Connect to a database.
Clear the CPU memory. Generally, the server takes care of memory management and you would not need to use this command. If you are having unexpected memory issues, you can try clearing the CPU memory to see if performance improves.
Clear the GPU memory. Generally, the server takes care of memory management and you would not need to use this command. If you are having unexpected memory issues, you can try clearing the GPU memory to see if performance improves.
Copy or append data from client-side file to table. The file is assumed to be in CSV format unless the file name ends with
Switch to CPU mode in the current session.
Describe table columns using a SQL CREATE TABLE statement.
Describe the results of a view SELECT statement.
List all dashboards accessible by the current user.
Displays the inferred schema for CSV/TSV files, or the actual schema for Parquet files.
Exports a dashboard to a filepath. Files with spaces in their names should be quoted. If there is a quote within a quoted string, it should be escaped with a backslash.
Switch to GPU mode in the current session.
Help. List available backslash commands.
Set the history buffer size (default is 100).
Imports a dashboard from a filepath. Files with spaces in their names should be quoted. If there is a quote within a quoted string, it should be escaped with a backslash.
Print memory usage summary.
Set multi-line command mode.
Do not print timing information.
Return the optimal CREATE TABLE statement for a table, based on the size of the actual data stored.
Reports all privileges granted to an object for all roles and users.
Reports all database object privileges granted to role or user.
Reports all roles granted to user.
Reports all roles.
Applies license key to the OmniSci instance. Does not require the services to be restarted to apply the license change.
Set single-line command mode.
Get the status of the server and its leaf nodes.
List tables, with optional regular expression.
Print timing information.
List users, with optional regular expression.
List views, with optional regular expression.
Print OmniSciDB server version.
Unlike SQL statements, backslash commands do not require a terminating semicolon character.
\v commands might return a long list of values. You can use a regular expression match pattern to filter the results. For example, you could use the following command to return only tables that start with the word flight.
omnisql> \t ^flight.*flights_2008_10kflights_2008_7M
SQL query example:
omnisql> SELECT * FROM movies WHERE movieId=260;movieId|title|genres260|Star Wars: Episode IV - A New Hope (1977)|Action|Adventure|Sci-Fi
Backslash command example that describes a table:
omnisql> \d moviesCREATE TABLE movies (movieId INTEGER,title TEXT ENCODING DICT(32),genres TEXT ENCODING DICT(32))
If you frequently perform the same tasks, you can create a script and pipe it to omnisql. You can use both SQL commands and omnisql commands in your script.
cat script.sql | omnisql -p <password>
For example, if you periodically upload data to the movies table, you can append rows from files named movies.csv using the following script, and display the results.
\copy ./movies.csv moviesselect * movies;
When you pipe the script to omnisql, you get results similar to the following.
$ cat ~/script.sql | ./omnisql -p MyPasswordShhSecretUser omnisci connected to database omniscimovieId|title|genres1|Explosions Extravaganza|Action2|Cuddle Time|Romantic Comedy3|Chuckle Buddies|Comedy4|All the Feels|DramaUser omnisci disconnected from database omnisci