[TOC]
Command line is one of the methods for querying in Quicksql. It's just like Hive and MySql, in which you can make queries using command like " hive/mysql -e 'select 1' ". Need to know that we only implement the way of command, and the interactive way like REPL is coming soon.
After deploying Quicksql successfully in system, you can start to try qsql command.
Here is the example, which you can run in Quicksql directory:
./bin/qsql -e "SELECT 1"
SELECT 1
is the simplest SQL which can run everywhere, that is why we use it as the example here. Then you can choose a specific calculation engine:
./bin/qsql -e "SELECT 1" --runner spark
The command above will start an spark program to execute the query. The --runner
configure can be set for different engines, e.g., JDBC. And you can find more detailed description of the configure in [Configuration](### Configuration)
There are other configures which you can set for controlling engine calculation.
For example:
./bin/qsql -e "SELECT 1" --runner spark --driver_memory 2G --worker_memory 2G
Run the command, then you will start a spark program to execute the query with 2G Driver Memory and 2G Executor Memory.
Also, you can use -h
for detailed Configuration like below:
./bin/qsql -h
Note that you'd better initialize [meta data](#Meta Data) before for better experience.
There are several configurations which you can set in Command Line.
Property Name | Default | Meaning |
---|---|---|
-e | -- | Set the query SQL. Required if you try to start a query. |
-h|--help | -- | Find the description of configuration |
--runner | dynamic | Set the engine runner, including dynamic, jdbc or spark |
--master | yarn-client | Set the mode of engine execution |
--worker_memory | 1G | Per memory of workers, like executor in Spark |
--driver_memory | 3G | Memory of driver, like driver in Spark |
--worker_num | 20 | Number of workers, like executor in Spark |
Notice:
- You can set default value of runner, master, worker_memory, driver_memory and worker_num in /conf/base-env.sh
- Master, worker_memory, driver_memory and worker_num will not be effective when query executed through JDBC, although you might have configured them.
Default Meta data is saved in Sqlite inside of Quicksql project. And the database Schema.db will exist in /metastore in Quicksql directory when deployed successfully. You can also change the storage of metadata using metadata related command.
Of course, a connection information of other storage engine need to be configured. You can configure them in /conf/metadata.properties.
Then, run the following command in Quicksql directory and you can initialize the metadata tables in MySql.
./bin/metadata --dbType mysql --action init
You can also delete the Quicksql metadata tables with command:
./bin/metadata --dbType mysql --action delete
There are two configurations for metadata:
PropetyName | Default | Meaning |
---|---|---|
--dbType | Type of storage engine. Now we only support MySql. | |
--action | Actions for metadata, including init and delete. |