gd_querydeleted

Performs queries over metadata or Python dictionaries marked for deletion in the archive.

 

Syntax 

qresults = gd_querydeleted(query,datasource='file',

                           resultfields='*')

 

Description

qresults = gd_query(query,datasource,resultfields) has exactly the same functionality as gd_query but performs the queries over data that has been marked for deletion using the gd_markfordeletion function. gd_querydeleted returns a list of metadata dictionaries, one for each matching result. The ['standard']['ID'] value from each result can be passed to the gd_unmarkfordeletion function, which can recover data that was mistakenly marked for deletion. This function will only return results for data that has not already been permanently deleted from the archive by an administrator.

 

A brief description of the input arguments is given here, see gd_query for further information. To view the query results, use function gd_display.

 

Input Arguments

query                   A query takes the form 'field.subfield = value' where field is a key in the archived metadata/variable dictionary and subfield is a key in a subdictionary, for example iterations or standard.ID. The value is an alphanumeric value the field should contain, and can also be thought of as the value part of a dictionary entry. The operator & (meaning ‘and’) can be used to specify more than one search condition.

 

datasource        The data source indicates which type of data to query, and can be specified by one of the following strings (the default datasource value is 'file'):

 

‘file’

Metadata about files.

‘datagroup’

Metadata about datagroups.

‘monitor’

Metadata about monitorable datagroups.

‘varmeta’

Metadata about Jython variables.

‘var’

Jython variables.

 

resultfields The resultfields string is a comma separated list indicating which fields should be returned for each result, for example just the standard.ID fields (i.e. {'standard':{'ID':id_value}}). The default, *, returns all fields.

 

Examples

Query variable metadata that has been marked for deletion, and then unmark the corresponding variables so that they are no longer eligible for deletion from the archive.

 

from gddatabase import *

q = 'standard.archiveDate > 2004-12-01 & a.b < -500'

qresults = gd_querydeleted(q,'varmeta')

IDs = []

for i in range(len(qresults)):

    IDs.append(qresults[i]['standard']['ID'])

 

unmarktotal = gd_unmarkfordeletion(IDs)

print unmarktotal

 

5

 

Notes

When querying standard date information (archiveDate or createDate), specify the date/time using the International Standard Date and Time Notation (ISO 8601) which is: "YYYY-MM-DD hh:mm:ss" (hh:mm:ss is optional).

 

Only results for data marked for deletion and owned by the user (i.e. data the user archived/created) will be returned.

 

If the marked data has been permanently deleted from the archive by an administrator it cannot be queried.

 

A valid proxy certificate is required (see gd_createproxy from the Geodise Compute Toolbox).

 

Your certificate subject must have been added to the authorisation database.

 

See also

gd_unmarkfordeletion, gd_markfordeletion, gd_display, gd_query, gd_createproxy

 



gd_query

contents

gd_retrieve

Copyright © 2005, The Geodise Project, University of Southampton