ObjDataDictionaryEdit extends ObjDataDictionary to provide YAML
export/import for data dictionary definitions. It exports the header row
and all field definitions for a given DictionaryCode/Package combination.
Exported files are written to local.documents/data_dictionary/ by default.
ObjDataDictionary.ObjDataDictionary
→ ObjDataDictionaryEdit.ObjDataDictionaryEdit ← this module
| Table | Purpose |
|---|---|
def_data_dictionary |
One header row per DictionaryCode/Package |
def_data_dictionary_field |
One row per field within a dictionary |
DictionaryCode and Package are stripped from field rows since they are
captured at the top level.
dictionary_code: CREDIT_SCORE
package: homechoice
fields:
- FieldName: AGE
Description: Applicant age in years
OpType: continuous
DataType: integer
LeftMargin: 18.0
RightMargin: 80.0
- FieldName: INCOME_BAND
Description: Monthly income band
OpType: categorical
DataType: string
Values: A,B,C,D
import_from_data() deletes fields first (FK constraint order), then the
header, then reinserts the header and all fields. This ensures a clean
replace on every import.
# Export a data dictionary
python factory.core/extend.edit/ObjDataDictionaryEdit.py save CREDIT_SCORE
# Custom output filename
python factory.core/extend.edit/ObjDataDictionaryEdit.py save CREDIT_SCORE \
--filename backup.yaml
# Import from YAML file
python factory.core/extend.edit/ObjDataDictionaryEdit.py load credit_score.yaml
# List all dictionaries
python factory.core/extend.edit/ObjDataDictionaryEdit.py list-dictionaries
| Method | Purpose |
|---|---|
load(dictionary_code, package) |
Load header + fields from DB |
list_dictionaries(package) |
List all dictionaries with field counts |
export_to_file(dictionary_code, filename, package) |
Export to YAML |
import_from_data(data, package) |
Import from in-memory dict |
import_from_file(filename, package) |
Import from YAML file |