Menu

import a liquid feedback dump

Import a liquid feedback dump

To import a liquid feedback database dump you will need a postgres(http://www.postgresql.org) installation where you store the dump in. The ant(http://ant.apache.org) script expect to access the database as user postgres with the password postgres. It also expect the command line tool psql in the path and the dump compressed with gzip.

Prepare ant

The main preparation and configuration is done in the property file lgfb.properties where you setup the jdbc driver and the other stuff for the database connection. For the moment two versions of the views exist.

  • lqfb2-db Works with the current liquid feedback instance of the pirate party germany.
  • lqfb-db Works with the current liquid feedback instance of the pirate party berlin.

The default is lqfb2-db you may change it by setting the property database.script.dir .
To change the path of the psql tool you can use the property pgsql.

To import the graph directly with ant, there is an ant task ImportGraph you could use inside of eclipse, as we need the whole emf stuff for it.

Setup the ImportGraph ant task

The ant ask is located in the plugin de.urszeidler.lqfb.dataimporter and is installable from the zipped update site via the /de.urszeidler.lqfb.dataimporter.feature. You simply install the /de.urszeidler.lqfb.dataimporter.feature to have the task enabled. The ant process need to be started in the VM of eclipse(in the JRE tab of the start configuration).

ImportGraph

Imports the graph data from the lqfb dump. It uses the same code as in [import raw data to local store] it reads the configured graph and stores it in the defined local store.

Parameters

Attribute Description Required default
newgraphname The name of the imported graph. yes
databaseurl The url for the input database. yes
databaseuser The databsae user. yes
databasepass The datapase pass. yes
outputdbtype The type of the output db de for the Derby db and pg for postgres. yes
createoutputdb Creates the database, works with derby not with pg no false
outputdatabaseurl The urls for the datastore yes
outputdatabaseuser The database user yes
outputdatabasepass The pass for the user yes
closeinputstore Closes the input store after the import. no false
closeoutputstrore Closes the output store, if the store is a Derby db it also shuts down the database, as Derby normally works in single mode. no false

Prepare a liquid feedback dump.

First of all, read the terms of your dump.

The import has two phases.

Import the dump

In the first a new database and user is created, while an old one is dropped, and the dump will be unzipped and imported in the newly created database. Some basic view are also created.

The ant target for this action is :

  • setup.lqfb.database

The ant script is controlled by some properties

  • database.import.file.gz The databes dump file
  • database.name The name of the database.

Be aware the user and the database will be dropped first, per default the user name is the database name.

define the concrete mapping

In the second the concrete views for the graph is created. The second step depends on what data you like to import.

  • setup.graph.delegation which set up the views for a delegation graph.
  • setup.members.voting.initative which setup a graph with the initiative and members and their votes, be aware that you filter for the initiative if you use a greater database
  • setup.graph.connections

The only property is

  • database.name The name of the database.

Import the different graphs after import

When you run Ant inside of eclipse and have the ant task installed you could import all graph directly after the database import.

  • import.all.graphs
    This target imports all available graphs. It uses a macro import-graph to encapsulate the task and the preparation. The parameter graph.type need to correspond to a setup.graph.@{graph.type} target to prepare the views.

The only important properties are :

  • graph.output.db.dir.path The path to the derby database.
  • database.name The name of the input database.

examples

ant setup.lqfb.database -Ddatabase.import.file.gz=/liquidfeedback_piratenpartei_2012-09-04_03-16_CEST.sql.gz -Ddatabase.name=lqfb_2012_09_04

will setup a databse from the dump with the name lqfb_2012_09_04

ant setup.lqfb.database setup.graph.delegation -Ddatabase.import.file.gz=/liquidfeedback_piratenpartei_2012-09-04_03-16_CEST.sql.gz -Ddatabase.name=lqfb_2012_09_04

will setup a database from the dump with the name lqfb_2012_09_04 and also define the delegation views

ant setup.members.voting.initative -Ddatabase.name=lqfb_2012_09_04

Will setup the voting view for the database lqfb_2012_09_04.

ant setup.lqfb.database import.all.graphs -Ddatabase.import.file.gz=/file.sql.gz -Ddatabase.name=lqfb_2013_01_06_be -Dgraph.output.db.dir.path=/path.to.db
will import the database and then import all available graphs in the defined store.

After you setup a database you can [import raw data to local store].

Other targets

There are some other useful targets.

  • echo.dump.checksum will echo the SHA1 checksum, the filename and the property wiki.user
  • create.output.store will create the graph store at the graph.output.db.dir.path
  • cleanup.database will drop the database.name and the user

Related

Wiki: Home
Wiki: ant lqfb reports
Wiki: import many lqfb dumps
Wiki: import raw data to local store
Wiki: setup reporting