![](/img/trans.png)
[英]How to stream data into Google Cloud BigQuery using Appengine with Python Script-flowing data from API?
[英]GCP - Insert/Load Data to BigQuery from REST API using Google Cloud Function with Python
Is it possible to directly insert/stream data from a rest api with json output to bigquery in gcp using cloud function?
做一些研究,但它總是要求放入 GCS 存儲桶,然后創建雲 function 以將數據加載到 bigquery。
提前致謝。
是的,您無需通過 GCS 即可加載它。 使用本教程作為指南(使用 JSON 文件)將我們帶到此源代碼(由教程中的雲 Function 使用),您可以看到它所做的只是將存儲桶文件加載到一個 blob 中,然后加載到 Z466DEEC76ECDF54DCA54332:
row = json.loads(blob.download_as_string())
之后只需使用insert_rows_json方法即可:
BQ.insert_rows_json(table, json_rows=[row],
row_ids=[file_name],
retry=retry.Retry(deadline=30))
So, you can just send from your API the requests with a POST to a HTTP Cloud Function and that function use the above code to load the json fo BigQuery.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.