HOTMapper Commands
Updated with v1.0.
This page contains information about all HOTMapper commands.
Summary
Basic Format
All HOTMapper commands follow the pattern bellow:
$ ./manage.py [command] [positional arguments] [optional arguments with value]
By default, the execution of
$ ./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
$ ./manage.py create <table_name>
- Example:
$ ./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.
$ ./manage.py insert <path to file> <table_name> <*[YEAR]> [--sep=csv separator]
The *[YEAR] field is the same of the mapping protocol.
The sep
parameter default is ';'
For this command work, it's needed that the table was made with the create command from HOTMapper.
- Example:
$ ./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.
$ ./manage.py drop <table_name>
- Example:
$ ./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 usage of RAM.
$ ./manage.py remap <table_name>
- Example:
$ ./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.
$ ./manage.py update_from_file <path to file> <table_name> <*[YEAR]> [--sep=csv separator] [--columns column_names]
- Example:
$ ./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.
$ ./manage.py run_aggregations <table_name>
- Example:
$ ./manage.py run_aggregations table_test