nuosql Files
There are three types of files used by the nuosql
tool:
Configuration File (.nuosql.config
)
.nuosql.config
is a user-defined configuration file used to specify commonly used nuosql
command-line options.
The default location of the .nuosql.config
file is the $HOME
directory.
If the file is stored in a different location, specify the path using the --config
option.
For example, to access a database called test
with the options --user cloud
, --password user
, and --schema myschema
, instead of specifying these options on the command line everytime nuosql
is invoked, create a $HOME/.nuosql.config
file with the following contents:
user cloud
password user
schema myschema
Since the .nuosql.config
file is in the default location, $HOME
, invoke nuosql
as follows:
nuosql test
If the .nuosql.config
file is stored in a non-default location, specify the path using the --config
option.
For example, if the configuration file is stored in /tmp/my.nuodb.config
, then invoke nuosql
as follows:
nuosql test --config /tmp/my.nuodb.config
Initialization File (.nuosql.init
)
.nuosql.init
is a user-defined configuration file that contains SQL commands to be executed by nuosql
.
The default location of the nuosql.init
file is the $HOME
directory.
If the file is stored in a different location, specify the path using the --init
option.
The commands in the .nuosql.init
file are executed every time nuosql
starts up.
This .nuosql.init
can include any valid SQL statement and is particularly useful for the SET
command and specifying settings such as “SET PAGER less
” and “SET OUTPUT VERTICAL
”.
(See SET
.)
After connecting to the database and executing all the commands in the .nuosql.init
file, nuosql
displays the usual command line prompt and waits for additional commands to be entered interactively.
History File (.nuosql.history
)
The .nuosql.history
file stores all the commands executed by nuosql
.
This file is created and updated by nuosql
automatically.
The default location of the .nuosql.history
file is the $HOME
directory.
If the file is stored in a different location, specify the path using the --history
option.
create table t (id int generated always as identity not null primary key, name varchar(10));
drop table t;
create table t (id int generated always as identity not null primary key, name varchar(10));
insert into t values (null, 'User1');
select * from t;
insert into t values (null, 'User2'), (null, 'User3');
select * from t;
create table t2 (id int generated always as identity not null primary key, name varchar(10));
drop table t2;
create table t2 (id int generated always as identity not null primary key, name varchar(10));
insert into t2 values (null, 'User1');
select * from system.properties;
help show
For more information, see Display Command-line History.