def _bq_cast(string_field, bq_type):
    if string_field is None:
        return None
    elif bq_type == 'INTEGER' or bq_type == 'TIMESTAMP':
        return int(string_field)
    elif bq_type == 'FLOAT':
        return float(string_field)
    elif bq_type == 'BOOLEAN':
        assert string_field in set(['true', 'false'])
        return string_field == 'true'
    else:
        return string_field
Helper method that casts a BigQuery row to the appropriate data types.
dataset/ETHPy150Open airbnb/airflow/airflow/contrib/hooks/bigquery_hook.py/_bq_cast