gavo.svcs.uploadcores module

Cores to alter the DB state from the Web.

Honestly: I doubt this type of http upload is a good idea in general. If given the choice, I’d go for uploading through rsync and using a timed job (or perhaps a trigger) any day.

class gavo.svcs.uploadcores.UploadCore(parent, **kwargs)[source]

Bases: Core

A core handling uploads of files to the database.

It allows users to upload individual files into a special staging area (taken from the stagingDir property of the destination data descriptor) and causes these files to be parsed using destDD. Note that destDD must have updating="True" for this to work properly (it will otherwise drop the table on each update). If uploads are the only way updates into the table occur, source management is not necessary for these, though.

You can tell UploadCores to either insert or update the incoming data using the “mode” input key.

attrSeq = [<gavo.base.parsecontext.ReferenceAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
inputTableXML = '\n\t\t<inputTable id="inFields">\n\t\t\t<inputKey name="File" type="file" required="True"\n\t\t\t\ttablehead="Source to upload"/>\n\t\t\t<inputKey name="Mode" type="text" tablehead="Upload mode"\n\t\t\t\trequired="True" multiplicity="forced-single">\n\t\t\t\t<values default="i">\n\t\t\t\t\t<option title="Insert">i</option>\n\t\t\t\t\t<option title="Update">u</option>\n\t\t\t\t</values>\n\t\t\t</inputKey>\n\t\t</inputTable>\n\t\t'
managedAttrs = {'destDD': <gavo.base.parsecontext.ReferenceAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'inputTable': <gavo.base.complexattrs.StructAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'outputTable': <gavo.base.complexattrs.StructAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>}
name_ = 'uploadCore'
outputTableXML = '<outputTable>\n\t\t\t\t\t<column name="nAffected" type="integer"\n\t\t\t\t\t\ttablehead="Number touched" required="True"/>\n\t\t\t\t</outputTable>'
property rd
run(service, inputTable, queryMeta)[source]
setProperty(name, value)