xia_engine_bigquery.schema.DocToSchema
- class xia_engine_bigquery.schema.DocToSchema
Bases:
object
XIA Document to Bigquery Json Schema
- __init__()
Methods
__init__
()get_field_json
(key, field)Get field basic description in json
get_schema_bq
(document_class[, is_log_table])Get Bigquery Schema from document class
get_schema_fields
(bq_schema[, path])Get field list of a Big Query Schema
get_schema_json
(document_class)Get Bigquery Schema from document class
json_to_schema
(json_schema)Get field basic description in json
Attributes
type_dict
- classmethod get_field_json(key: str, field: BaseField) Optional[dict]
Get field basic description in json
- Parameters
key – field’s given name
field – field instance
- Returns
python dictionary, None means not supported field (External field for example)
- classmethod get_schema_bq(document_class: type, is_log_table: bool = False)
Get Bigquery Schema from document class
- Parameters
document_class – Document class
is_log_table (bool) – it is a log table, should add extra information
- Returns
Big query schema definition
- classmethod get_schema_fields(bq_schema: list, path: str = 'root') set
Get field list of a Big Query Schema
- Parameters
bq_schema (list) – Big query schema definition
path (str) – parent path prefix
- Returns
set of fields
- classmethod get_schema_json(document_class: type)
Get Bigquery Schema from document class
- Parameters
document_class – Document class
- Returns
Big query schema definition in python list
- classmethod json_to_schema(json_schema: list) list
Get field basic description in json
- Parameters
json_schema – json schema list
- Returns
SchemaField List