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/QikkDB.ConsoleClient. Go to directory ./console. Run Console Client using command dotnet ./QikkDB.ConsoleClient.dll. 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\QikkDB.ConsoleClient.exe. Just double click on it or run it using powershell or cmd (.\QikkDB.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:.\QikkDB.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. .\QikkDB.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.0 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.0 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.2 Import currently support files in CSV and TSV format or text files in tabular structure with columns separated by a character and rows separated by a newline.

IMPORT database_name filename_with_path
[table-name=string_value]
[block-size=integer_value]
[has-header=boolean_value]
[column-separator=character_value]
[threads-count=integer_value]
[batch-size=integer_value]

The database has to exists before importing into it, but it does not need to be in use (command 'use').

If the database contains the table which has the same name as the input file (without extension) or the same name as specified by tablename argument, the imported data will be appended into this existing table. Data values parsed from the input data file will be casted into types specified by definition of the table. Note: When importing POLYGON data, it needs to be escaped using double quotes, because WKT of POLYGON uses commas as delimiter.

If the table does not exists, the table will be created and it's name will be the name of the imported data file (without extension).The types will be automatically guessed.

If optional arguments are not provided, default or automatically guessed values will be used.

Argument

Description

Default value

table-name

Name of the table into which the data will be imported. If the table does not exists, the new table will be created. If table already exists, the data will be appended.

The name of the data file, which is being imported without the file extension

block-size

Block size of the imported table (see Block size setting). Input value is an interger.

Value inherited from the database in which the data will be imported

has-header

Whether the first line of the input file is header. Input value is true or false.

true

column-separator

While parsing the input file, this single character determines how rows are splitted (columns of tabular data). Most common values are , or ;

Automatically guessed

threads-count

Number of threads parsing the input file and importing the parsed data. Input value is an integer.

Number of CPU cores of the client machine

batch-size

Number of lines of the input file parsed and imported in a single batch.

100 000

Example of usage:

IMPORT test_database "C:\temp\sample.csv"
IMPORT test_database "C:\temp\sample.csv" block-size=200000 has-header=false
column-separator=, batch-size=10000

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.0 Prints URL link where this documentation can be found.

Help, H

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

Exit, Quit, Q

Since version: 1.4.0 Exits the console program