Microsoft SQL Server To Google Cloud Storage 運算子¶
此 Google Cloud Storage (GCS) 服務用於儲存來自各種應用程式的大型資料。本頁說明如何將資料從 Microsoft SQL Server 複製到 GCS。
先決條件任務¶
若要使用這些運算子,您必須執行一些事項
使用 Cloud Console 選擇或建立 Cloud Platform 專案。
為您的專案啟用計費功能,如 Google Cloud 文件 中所述。
啟用 API,如 Cloud Console 文件 中所述。
透過 pip 安裝 API 程式庫。
pip install 'apache-airflow[google]'詳細資訊請參閱 安裝。
MSSQLToGCSOperator¶
MSSQLToGCSOperator
允許您將資料從 Microsoft SQL Server 資料庫上傳到 GCS。
以下是如何使用此運算子上傳資料到 GCS 的範例。
upload_mssql_to_gcs = MSSQLToGCSOperator(
task_id="mssql_to_gcs",
mssql_conn_id="airflow_mssql",
sql=SQL_QUERY,
bucket=BUCKET_NAME,
filename=FILENAME,
export_format="csv",
)
參考文獻¶
如需更多資訊,請參閱: * Microsoft SQL Server 文件 * Google Cloud Storage 文件