def scalars_extreme_table(bigquery_client: bigquery.Client, project_id: str, dataset_id: str): schema = bigquery_client.schema_from_json(DATA_DIR / "scalars_schema.json") job_config = bigquery.LoadJobConfig() job_config.schema = schema job_config.source_format = enums.SourceFormat.NEWLINE_DELIMITED_JSON full_table_id = f"{project_id}.{dataset_id}.scalars_extreme" with open(DATA_DIR / "scalars_extreme.jsonl", "rb") as data_file: job = bigquery_client.load_table_from_file(data_file, full_table_id, job_config=job_config) job.result() yield full_table_id bigquery_client.delete_table(full_table_id)
def bigquery_schema(bigquery_client: bigquery.Client): return bigquery_client.schema_from_json(DATA_DIR / "schema.json")