第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

BigQuery - 在 Airflow 運算符中使用 table_resource

BigQuery - 在 Airflow 運算符中使用 table_resource

森林海 2024-01-16 15:00:35
我想使用 Airflow 創(chuàng)建一個 BigQuery 表(通過 bigquery hook 或 bigquery 空表創(chuàng)建器)。不幸的是,無法使用范圍分區(qū)進行創(chuàng)建。有人提出了 PR,但為了最小化氣流操作員界面,他們建議跳過它。他們給出了這樣的解決方法。you can use the table_resource argument to pass any table definition you want, no need to specify every single parameter.我不清楚,在氣流中如何使用與范圍分區(qū)相關(guān)的 JSON。有人能給我一個如何使用/實施它的例子嗎?我嘗試了以下操作,但它創(chuàng)建了沒有分區(qū)的表。(它用于時間分區(qū),但 BQ 運算符有一個參數(shù),但我想嘗試使用table_resource.resource="""{    "TimePartitioning": {        "type": "DAY",        "field": "created_at"    }}"""schema="""[{"mode": "REQUIRED", "name": "code", "type": "STRING"}, {"mode": "REQUIRED", "name": "created_at", "type": "DATETIME"}, {"mode": "REQUIRED", "name": "service_name", "type": "STRING"}]"""def bq_create(**kwargs):    table_schema = 'bhuvi'    table_name = 'sampletable'    create = BigQueryCreateEmptyTableOperator (        task_id='create_bq_{}'.format(table_name),        project_id = 'myproject',        dataset_id=table_schema,        table_id=table_name,        schema_fields=json.loads(schema),        bigquery_conn_id='bigquery_default',        table_resource =json.loads(resource)        )    create.execute(context=kwargs)bqcreate = PythonOperator(            task_id="bqcreate",            python_callable=bq_create,            provide_context=True,            dag=dag        )bqcreate
查看完整描述

1 回答

?
拉莫斯之舞

TA貢獻1820條經(jīng)驗 獲得超10個贊

根據(jù)文檔,時間分區(qū)的正確鍵是timePartitioning,這不是問題嗎? https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table


查看完整回答
反對 回復(fù) 2024-01-16
  • 1 回答
  • 0 關(guān)注
  • 220 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號