mdf_reader.data_models.schemas

This module has functions to manage data model schema files and objects according to the requirements of the data reader tool

Module Contents

Functions

read_schema(schema_name=None, ext_schema_path=None)

Reads a data model schema file to a dictionary and

df_schema(df_columns, schema)

Creates a simple attribute dictionary for the elements

templates()

Lists the name of the available schema file templates

copy_template(schema, out_dir=None, out_path=None)

Copies a schema file template to an output

Attributes

py3

toolPath

schema_lib

templates_path

py3 = True[source]
toolPath[source]
schema_lib[source]
templates_path[source]
read_schema(schema_name=None, ext_schema_path=None)[source]

Reads a data model schema file to a dictionary and completes it by adding explicitly information the reader tool needs

Keyword Arguments
  • schema_name (str, optional) – The name of data model to read. This is for data models included in the tool

  • ext_schema_path (str, optional) – The path to the external data model schema file

Either schema_name or ext_schema_path must be provided.

Returns

Data model schema

Return type

dict

df_schema(df_columns, schema)[source]

Creates a simple attribute dictionary for the elements in a dataframe from its data model schema

Parameters
  • df_columns (list) – The columns in the data frame (data elements from the data model)

  • schema (dict) – The data model schema

Returns

Data elements attributes

Return type

dict

templates()[source]

Lists the name of the available schema file templates

Returns

Schema file templates alias

Return type

list

copy_template(schema, out_dir=None, out_path=None)[source]

Copies a schema file template to an output file or path

Parameters

schema (str) – Schema template name to copy

Keyword Arguments
  • out_dir (dict, opt) – Directory to copy schema file template to

  • out_path (dict, opt) – Full filename to copy schema file template to

  • out_dir or out_path must be provided (Either) –