Skip to content

Storing provenance in a relational database

Raza Ahmad edited this page Oct 17, 2018 · 22 revisions

An SQL storage can be added to SPADE using the controller, allowing provenance records to be sent to a relational database. The configuration arguments are loaded from cfg/spade.storage.PostgreSQL.config, or could be overriden through the command line in the form of space-separated key-value pair. If the username or password are not defined, the string literal null should be used.

H2

SPADE includes the H2 embedded SQL library. The following command can be used in the SPADE controller to store provenance in an H2 SQL database:

-> add storage H2 databasePath=/tmp/sql/spade.sql_db databasePassword=null
Adding storage H2... done

This will create /tmp/spade.sql_db in the filesystem if it does not exist, or use the existing database if it has previously been created. The username for connecting to this database will be loaded from the config file, and no password will be used.

The following command will cause SPADE to stop sending provenance records to the H2 database:

-> remove storage H2
Shutting down storage H2... done

PostgreSQL

To use SPADE with PostgresSQL, the database must be installed and running. This could be done by executing the script bin/installPostgres. After successful execution of this script, PostgreSQL is installed and started, and a database spadedb is created by the user spade. The following command can be used in the SPADE controller to store provenance in a PostrgreSQL database:

-> add storage PostgreSQL databasePath=spade_pg databaseUsername=john_doe databasePassword=12345
Adding storage PostgreSQL... done

This will create a database spade_pg in the SPADE directory if it does not exist, or use the existing database if it has previously been created. The username and password for connecting to this database will be john_doe and 12345.

The following command will cause SPADE to stop sending provenance records to the PostgreSQL database:

-> remove storage PostgreSQL
Shutting down storage PostgreSQL... done
Clone this wiki locally