目前,我正在数据融合中实现一个管道,允许将具有不同结构的多个文件上载到BigQuery中的多个表中。我已经用Google云存储参数设置器组件和Google BigQuery多表接收器进行了测试,但这是不可能的
https://cdap.atlassian.net/wiki/spaces/DOCS/pages/464912385/Google+BigQuery+Multi+Table+Sink
我还试图通过python代码进行测试,但也没有得到预期的结果
from google.cloud import bigquery
# Construct a BigQuery client object.
client = bigquery.Client()
# TODO(developer): Set table_id to the ID of the table to create.
# table_id = "your-project.your_dataset.your_table_name"
job_config = bigquery.LoadJobConfig(
schema=[
bigquery.SchemaField("name", "STRING"),
bigquery.SchemaField("post_abbr", "STRING"),
],
skip_leading_rows=1,
# The source format defaults to CSV, so the line below is optional.
source_format=bigquery.SourceFormat.CSV,
)
uri = "gs://cloud-samples-data/bigquery/us-states/us-states.csv"
load_job = client.load_table_from_uri(
uri, table_id, job_config=job_config
) # Make an API request.
load_job.result() # Waits for the job to complete.
destination_table = client.get_table(table_id) # Make an API request.
print("Loaded {} rows.".format(destination_table.num_rows))
您是否在数据融合中建立了一个流程,允许您将不同格式的多个文件动态加载到BigQuery中的不同表中
目前没有回答
相关问题 更多 >
编程相关推荐