IO 運算子

這些運算子在檔案系統或物件儲存上執行各種操作。

傳輸檔案

使用 FileTransferOperator 從一個位置複製檔案到另一個位置。運算子的參數為

  • src - 來源路徑,可以是字串或 ObjectStoragePath

  • dst - 目的地路徑,可以是字串或 ObjectStoragePath

  • src_conn_id - 來源連線 ID(預設值:None

  • dst_conn_id - 目的地連線 ID(預設值:None

  • overwrite - 覆寫目的地(預設值:False

如果 srcdst 都在相同的物件儲存上,複製將在物件儲存中執行。否則,資料將從來源串流到目的地。

以下範例展示如何實例化 FileTransferOperator 任務。

tests/system/common/io/example_file_transfer_local_to_s3.py[原始碼]

transfer = FileTransferOperator(src=temp_file_path, dst=AWS_BUCKET, task_id="transfer")

此條目是否有幫助?