star
tool is a cross-platform command-line tool, distributed as a stand-alone console application, used to manage Starcounter databases and applications. By using the star
tool, you can – for example – create, modify, delete and query Starcounter databases, as well as import and export data from compatible 3:rd party data sources.star
tool is to use it, in particular with the --help
option, which prints help information about available commands and options. In this article, we will provide a reference for the available commands and describe some common use cases.chmod -R u+x /path/to/star/tool/folder
).star
tool is a console application with a command-line interface, and we interact with it using commands, options and arguments.--help
is defined for each command, and can be used to print details on available options and sub-commands.star
tool expects Linux-style paths.new
command creates a new database at the absolute or relative path provided in the <path>
argument. If the directory referenced by the path does not exist, it will be created. To create a new database at the path C:\databases\mydb
, we run:start
command starts the database referenced by the absolute or relative path given in the <db>
argument. To start an existing database located at C:\databases\mydb
, we run:reload
command takes data from an SQLite database file referenced by the absolute or relative path in the <file>
argument and imports that data into the database referenced by the absolute or relative path given in the <db>
argument. To load data from an SQLite database file named myDatabase.sqlite3
located in C:\databases
into an existing database located at C:\databases\mydb
, we run:unload
command can be reloaded.unload
command selects the SQLite database file at the path given in the <file>
argument, or creates one if it doesn't exists, and then takes data from a database referenced by the absolute or relative path given in the <db>
argument and imports that data into the created SQLite database. To load data from an existing database located at C:\databases\mydb
into a new SQLite database file named myDatabase.sqlite3
at C:\databases
, we run:list
command is used together with one of the following sub-commands to list ranges of entities in a database:list table
sub-command lists all tables in the database referenced by the absolute or relative path given in the <db>
argument. The following options are available to configure the output of the command:--user
-u
--system
-s
--format
-f
t
– Include the name of the table to list.b
– Include the name of the base table (if inherited) of the table to list.C:\databases\mydb
, including only user tables and displaying both the name of the table and the name of its base table (if any), we run:list index
sub-command lists all indexes in a table, the name of which is specified by the <table>
argument, in the database referenced by the absolute or relative path given in the <db>
argument. The following options are available to configure the output of the commmand:--user
-u
--system
-s
--inherited
-i
--format
-f
i
– Include the name of the index to list.t
– Include the name of the table of the index.u
– Include whether or not the index is unique.MyApp.Superhero
, of an existing database located at C:\databases\mydb
, including both user indexes and system indexes and both the name of the index and whether it's unique, we run:info
command is used together with one of the following sub-commands to print info about some specific entity in a database:info table
sub-command prints detailed information about a table, the name of which is specified in the <table>
argument, in the database referenced by the absolute or relative path given in the <db>
argument. The following options are available to configure the output of the command:--user
-u
--system
-s
--inherited
-i
--format
-f
c
– Include the name of the columns of the table to list.t
– Include the datatype of the columns of the table to list.n
– For each column, include whether it accepts null values in table cells.i
– For each column, include whether it is inherited.b
– Include the name of the table of the column.MyApp.Superhero
table of an existing database located at C:\databases\mydb
, including inherited columns and listing only the names and the datatypes of columns, we run:info index
sub-command prints detailed information about an index, the name of which is specified in the <index>
argument, in the database referenced by the absolute or relative path given in the <db>
argument. The following options are available to configure the output of the command:--format
-f
c
– Include the name of the column that the index is registered on.b
– Include the name of the table that holds the column that the index is registered on.MyApp.Superhero
table of an existing database located at C:\databases\mydb
, including only the name of the column of the index, we run:star
tool includes a built-in SQL REPL (read-eval-print loop) component that can be used to execute DDL and DML statements on the database referenced by the absolute or relative path given in the <db>
argument.C:\databases\mydb
, we run: