Export API

Functions for listing completed calculations and outputs, as well as exporting outputs to files.

Functions for getting information about completed jobs and calculation outputs, as well as exporting outputs from the database to various file formats.

exception openquake.engine.export.core.DataStoreExportError[source]

Bases: exceptions.Exception

openquake.engine.export.core.LT_PATH_JOIN_TOKEN = '_'

Used to separate node labels in a logic tree path

openquake.engine.export.core.export(output_id, target, export_type='xml, geojson, csv')[source]

Export the given calculation output_id from the database to the specified target directory in the specified export_type.

openquake.engine.export.core.export_from_datastore(output_key, output, target)[source]
  • output_key – a pair (ds_key, fmt)
  • output – an Output instance
  • target – a directory, temporary when called from the engine server
openquake.engine.export.core.get_outputs(job_id, output_type=None)[source]

Get all openquake.server.db.models.Output objects associated with the specified job and output_type.


django.db.models.query.QuerySet of openquake.server.db.models.Output objects.


Make all of the directories in the path using os.makedirs.

openquake.engine.export.core.zipfiles(fnames, archive)[source]

Build a zip archive from the given file names.

  • fnames – list of path names
  • archive – path of the archive

Hazard Export

API for exporting hazard artifacts from the DB.