Console Client

The console is one of the ways to communicate with the database server. It allows you to enter data definition or manipulation queries, import data or benchmark timings.

Running the Console Client

Linux

Console client is located in ./console/ColmnarDB.ConsoleClient. Run it using command ./ColmnarDB.ConsoleClient if you are located in directory ./console. Console have to be started after the successful start of database core. Start by typing command help to see all the options that console supports (the list of supported console commands is documented here as well).

Windows

Console client is located in .\console\ColmnarDB.ConsoleClient.exe. Just double click on it or run it using powershell or cmd (.\ColmnarDB.ConsoleClient.exe). Console have to be started after the successful start of database core. Start by typing command help to see all the options that console supports (the list of supported console commands is documented here as well).

Specify host

Default host is 127.0.0.1:12345 (localhost). You can specify host using argument -h ip:port when starting the console client. For example (Windows) like this:.\ColmnarDB.ConsoleClient.exe -h 86.110.229.2:8999.

Specify timeout

When the conection with database server is lost, the console client will try to established this connection again. The timeout represents, how long (ms) shall the console client be trying to establish connection with database server again. If the connection is still not established when the timeout is reached, the console client will close itself. Default value is 30,000 ms. You can specify timeout using argument -t value when starting the console client. For example (Windows) like this. .\ColmnarDB.ConsoleClient.exe -t 50000.

Commands

Console supports following commands or directly written SQL queries. Syntax of commands is case insensitive.

Use, U

USE database_name, U database_name

Since version: 1.4 Prior to running the query, it is necessary to specify database, by Use command. This changes context to all subsequent queries.

If you are not sure about the names of imported databases, enter SHOW DATABASES command.

If there is no database, it should be created by running query CREATE DATABASE.

Query

[QUERY] sql_query

Since version: 1.4 Query itself written according to currently supported SQL syntax for data definition or data modification. Query command is optional and SQL query can be directly written to the console client.

If you are not sure about tables and columns in the database in use, enter SHOW TABLES and SHOW COLUMNS FROM table_name.

Script, S

SCRIPT file_path, S file_path

Since version: 1.4.2 Runs SQL queries from a file path (also supports console client command USE and IMPORT). Commands in script file are seprated by new line, so every command has to start on a new line and end on the line it started. If you want to skip a command or a query in a script file, just make that command a single line comment (in sql, single line comments starts with double dash '--').

Import, I

Since version: 1.4 Import currently support only CSV files or files with comma separated columns.

IMPORT database_name filename_with_path
[block_size] [has_header] [column_separator] [threads_count] [batch_size]

The database has to exists before importing into it, but it does not need to be in use (using command 'use'). If the database has the table which is named the same as the file which we are importing (without extension), the imported data will be appended into this existing table. If the table does not exists, the table will be created and it's name will be the name of the imported file (without extension).

If optional arguments are not supported, default values and automatic guessing will be performed:

  • block_size is set according to default configuration of the database server

  • has_header is by default true

  • column_separator is guessed automatically

  • threads_count is set by CPU number of cores

  • batch_size is by default 100 000

Example:

IMPORT test_database "C:\temp\sample.csv"

Timing, T

Since version: 1.4.1 Runs a query 201 times and prints the first run execution time and average execution time from 200 cached query runs.

Docs, Man

Since version: 1.4 Prints URL link where this documentation can be found.

Help, H

Since version: 1.4 Provides information about supported commands and their syntax.

Exit, Quit, Q

Since version: 1.4 Exits the console program