Package gavo :: Package rscdef :: Module rmkdef :: Class RowmakerDef
[frames] | no frames]

Class RowmakerDef

source code

                   object --+            
                            |            
 base.structure.StructureBase --+        
                                |        
                   object --+   |        
                            |   |        
           base.common.Parser --+        
                                |        
base.structure.ParseableStructure --+    
                                    |    
             base.structure.Structure --+
                                        |
                   object --+           |
                            |           |
     base.macros.MacroPackage --+       |
                                |       |
   base.macros.StandardMacroMixin --+   |
                                    |   |
                   RowmakerMacroMixin --+
                                        |
                                       RowmakerDef
Known Subclasses:

A definition of the mapping between grammar input and finished rows ready for shipout.

Rowmakers consist of variables, procedures and mappings. They result in a python callable doing the mapping.

RowmakerDefs double as macro packages for the expansion of various macros. The standard macros will need to be quoted, the rowmaker macros above yield python expressions.

Within map and var bodies as well as late apply pars and apply bodies, you can refer to the grammar input as vars["name"] or, shorter @name.

To add output keys, use map or, in apply bodies, add keys to the result dictionary.

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
completeElement(self, ctx) source code
 
compileForTableDef(self, tableDef)
returns a function receiving a dictionary of raw values and returning a row ready for adding to a tableDef'd table.
source code
 
copyShallowly(self) source code
 
getFullId(self) source code

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement, onElementComplete, validate

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from RowmakerMacroMixin: macro_dlMetaURI, macro_docField, macro_fullPath, macro_inputRelativePath, macro_inputSize, macro_lastSourceElements, macro_property, macro_qName, macro_rootlessPath, macro_rowsMade, macro_rowsProcessed, macro_sourceCDate, macro_sourceDate, macro_srcstem, macro_standardPubDID

Inherited from base.macros.StandardMacroMixin: macro_RSTservicelink, macro_RSTtable, macro_decapitalize, macro_getConfig, macro_internallink, macro_magicEmpty, macro_metaSeq, macro_metaString, macro_rdId, macro_rdIdDotted, macro_schema, macro_test, macro_today, macro_upper, macro_urlquote

Inherited from base.macros.MacroPackage: execMacro, expand, getExpander, listMacros, macro_quote, macro_reSub, macro_sql_standardPubDID, macro_sqlquote

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
makeIdentityFromTable(cls, table, **kwargs)
returns a rowmaker that just maps input names to column names.
source code
 
makeTransparentFromTable(cls, table, **kwargs)
returns a rowmaker that maps input names to column names without touching them.
source code

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'rowmaker'
a sentinel for all kinds of undefined values.
  attrSeq = [<gavo.base.complexattrs.StructListAttribute object>...
  managedAttrs = {'apply': <gavo.base.complexattrs.StructListAtt...

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties
  rd

Inherited from object: __class__

Method Details

makeTransparentFromTable(cls, table, **kwargs)
Class Method

source code 

returns a rowmaker that maps input names to column names without touching them.

This is for crazy cases in which the source actually provides pre-parsed data that any treatment would actually ruin.

completeElement(self, ctx)

source code 
Overrides: base.structure.Structure.completeElement

compileForTableDef(self, tableDef)

source code 

returns a function receiving a dictionary of raw values and returning a row ready for adding to a tableDef'd table.

To do this, we first make a rowmaker instance with idmaps resolved and then check if the rowmaker result and the table structure are compatible.


Class Variable Details

attrSeq

Value:
[<gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.attrdef.StringListAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.parsecontext.OriginalAttribute object>,
 <gavo.rscdef.common.RDAttribute object>,
 <gavo.base.attrdef.IdMapAttribute object>,
...

managedAttrs

Value:
{'apply': <gavo.base.complexattrs.StructListAttribute object>,
 'apps': <gavo.base.complexattrs.StructListAttribute object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'idmaps': <gavo.base.attrdef.StringListAttribute object>,
 'ignoreOn': <gavo.base.complexattrs.StructAttribute object>,
 'map': <gavo.base.complexattrs.StructListAttribute object>,
 'maps': <gavo.base.complexattrs.StructListAttribute object>,
 'original': <gavo.base.parsecontext.OriginalAttribute object>,
...

Property Details

rd

Get Method:
unreachable._getRD(self)