|
|
# HOTMapper Commands
|
|
|
This page contains information about all HOTMapper commands.
|
|
|
|
|
|
## Summary
|
|
|
* [Basic Format](#basic-format)
|
|
|
* [Create](#create)
|
|
|
* [Insert](#insert)
|
|
|
* [Drop](#drop)
|
|
|
* [Remap](#remap)
|
|
|
* [Update From file](#update_from_file)
|
|
|
* [Run Aggregations](#run_aggregations)
|
|
|
|
|
|
#### Basic Format
|
|
|
All HOTMapper commands follow the pattern bellow:
|
|
|
~~~bash
|
|
|
$ ./manage.py [command] [positional arguments] [optional arguments with value]
|
|
|
~~~
|
|
|
By default, the execution of
|
|
|
~~~bash
|
|
|
$ ./manage.py
|
|
|
~~~
|
|
|
Returns a list with all available commands and a brief description.
|
|
|
|
|
|
#### create
|
|
|
Utilizing the mapping protocol and table definitions, the create command will make the table passed as parameter in the
|
|
|
database specified in settings.py
|
|
|
~~~bash
|
|
|
$ ./manage.py create <table_name>
|
|
|
~~~
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py create table_test
|
|
|
~~~
|
|
|
|
|
|
#### insert
|
|
|
The insert command puts the data from a csv file into a specified table. The commands needs the absolute path of the
|
|
|
csv file to work.
|
|
|
~~~bash
|
|
|
$ ./manage.py insert <path to file> <table_name> <*[YEAR]> [--sep=csv separator]
|
|
|
~~~
|
|
|
The *[YEAR] field is the same of the [mapping protocol](../Mapping-Protocols).
|
|
|
|
|
|
The sep parameter default is ';'
|
|
|
|
|
|
For this command work, it's needed that the table was made with the create command from HOTMapper.
|
|
|
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py insert ~/hotmapper/open_data/EAG_GRAD_RATES_2016.csv table_test 2016 --sep="|"
|
|
|
~~~
|
|
|
|
|
|
#### drop
|
|
|
The drop command is used to remove a table from the database. If there's any dependency with the table the command
|
|
|
will fail.
|
|
|
~~~bash
|
|
|
$ ./manage.py drop <table_name>
|
|
|
~~~
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py drop table_test
|
|
|
~~~
|
|
|
|
|
|
#### remap
|
|
|
The remap command synchronizes a table with it's mapping protocol. The remap permits the creation, drop
|
|
|
and rename of columns. Be aware that the bigger the table the bigger the useage of RAM memory.
|
|
|
~~~bash
|
|
|
$ ./manage.py remap <table_name>
|
|
|
~~~
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py remap table_test
|
|
|
~~~
|
|
|
|
|
|
#### update_from_file
|
|
|
With the update_from_file command is possible to update columns from a database table. It's used when the pairing of a
|
|
|
columns is changed or it's source data. The command format is very similar with the insert.
|
|
|
~~~bash
|
|
|
$ ./manage.py update_from_file <path to file> <table_name> <*[YEAR]> [--sep=csv separator] [--columns column_names]
|
|
|
~~~
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py insert ~/hotmapper/open_data/EAG_GRAD_RATES_2016.csv table_test 2016 --sep="|"
|
|
|
~~~
|
|
|
|
|
|
#### run_aggregations
|
|
|
To run or update SQL functions like AVG, SUM and DIV it's used the run_aggregations command.
|
|
|
~~~bash
|
|
|
$ ./manage.py run_aggregations <table_name>
|
|
|
~~~
|
|
|
* Example:
|
|
|
~~~bash
|
|
|
$ ./manage.py run_aggregations table_test
|
|
|
~~~ |
|
|
\ No newline at end of file |