Google Calendar 到 Google Cloud Storage 傳輸運算子¶
Google 提供了一項服務 Google Cloud Storage。該服務用於儲存來自各種應用程式的大量資料。
使用 Google Calendar,您可以快速安排會議和活動,並獲取即將進行的活動的提醒,從而始終了解接下來要做什麼。
前提任務¶
要使用這些運算子,您必須執行以下幾項操作
使用 Cloud Console 選擇或建立 Cloud Platform 專案。
為您的專案啟用結算功能,詳見 Google Cloud 文件。
啟用 API,詳見 Cloud Console 文件。
透過 pip 安裝 API 庫。
pip install 'apache-airflow[google]'有關 安裝 的詳細資訊。
將資料從 Google Calendar 上傳到 GCS¶
要將資料從 Google Calendar 上傳到 Google Cloud Storage,您可以使用 GoogleCalendarToGCSOperator。
tests/system/google/cloud/gcs/example_calendar_to_gcs.py
upload_calendar_to_gcs = GoogleCalendarToGCSOperator(
task_id="upload_calendar_to_gcs",
destination_bucket=BUCKET_NAME,
calendar_id=CALENDAR_ID,
api_version=API_VERSION,
gcp_conn_id=CONNECTION_ID,
)
您可以將 Jinja 模板 與 calendar_id、destination_bucket、destination_path、impersonation_chain 一起使用。