def create_table_schema()

in datasets/open_buildings/pipelines/_images/run_script_kub/script.py [0:0]


def create_table_schema(schema_filepath) -> list:
    logging.info("Defining table schema")
    schema = []
    with open(schema_filepath) as f:
        sc = f.read()
    schema_struct = json.loads(sc)
    for schema_field in schema_struct:
        fld_name = schema_field["name"]
        fld_type = schema_field["type"]
        try:
            fld_descr = schema_field["description"]
        except KeyError:
            fld_descr = ""
        fld_mode = schema_field["mode"]
        schema.append(
            bigquery.SchemaField(
                name=fld_name, field_type=fld_type, mode=fld_mode, description=fld_descr
            )
        )
    return schema