Python based command-line tool for setting up a SIGUANET
SIGUANET is a free software project that aims to share the University of Alicante's corporate built asset management technology (SIGUA) with the developers community. In this sense, SIGUANET will hopefully be useful for other universities and academic organizations.
This is a command-line tool that helps DBAs to set-up an existing PostgreSQL/PostGIS database as a SIGUANET database which fits the needs of the organization.
This includes the generation of one PostGIS entity for each expected floor level, along with tables, rules and functions concerning enclosure categorisation, employees' data and localization, and department structure.
The siguanet-dbsetup command provides a simple interface which can be localized using gettext. Presently only english and spanish languages are available. Instructions on localization can be found into the locale\
folder.
If you're willing to test a SIGUANET database using sample data, please consider using the siguanet-dbdemo tool.
Please, bear in mind this tool won't create a database for you. A clean PostGIS database is needed which meets the following requirements:
- PostgreSQL 9.1 or greater
- PostGIS 2.0 or greater
Remember that, beginning with version 2.0, PostGIS is installed as an extension on a per-database basis, thus making the management of geodatabases much cleaner.
This Python script has been tested on both, Python 2.7 and Python 3.2 environments on Linux boxes. It makes use of some libraries which may or may not be present in your distribution. Please ensure you have the following python modules installed:
- argparse (only for Python < 2.7)
- mako
- psycopg2
The siguanet-dbsetup command requires 3 parameters from the user in order to generate an SQL script with database object definitions. This script is dynamically generated by means of further processing a predefined mako template. In its simplest form, you can invoke the command like this:
$ siguanet-dbsetup.py srid aboveground underground
This will create a siguanet-dbsetup.sql
script on your executable's path. In this script:
- all PostGIS geometry definitions will be referenced to the spatial reference system specified in
srid
- as many PostGIS entity definitions for aboveground and basement floor levels as indicated by the
aboveground
andunderground
parameters will be created
In order to save the output SQL script to a specific location, use:
$ siguanet-dbsetup.py -o /path/to/youroutputscript.sql
Finally, if you prefer to directly execute the generated script against your PostgreSQL server, use the connection definition options provided. For information on all options execute:
$ siguanet-dbsetup.py -h