DatabricksReposCreateOperator

使用 DatabricksReposCreateOperator 來透過 api/2.0/repos API 端點建立 (並選擇性地檢出) Databricks Repos

使用運算子

要使用此運算子,您至少需要提供 git_url 參數。

參數

輸入

git_url: str

Git 儲存庫的必要 HTTPS URL

git_provider: str

Git 提供者的選用名稱。如果我們無法從 URL 推測其名稱,則必須提供。請參閱 API 文件以取得支援的 Git 提供者實際列表。

branch: str

要檢出的現有 Git 分支的選用名稱。

tag: str

要檢出的現有 Git 標籤的選用名稱。

repo_path: str

Databricks Repos 的選用路徑,例如,/Repos/<user_email>/repo_name。如果未指定,它將在使用者目錄中建立。

ignore_existing_repo: bool

如果具有給定路徑的儲存庫已存在,則不要拋出例外。

databricks_conn_id: string

要使用的 Airflow 連線的名稱。

databricks_retry_limit: integer

如果 Databricks 後端無法連線時,重試的次數。

databricks_retry_delay: decimal

重試之間等待的秒數。

範例

建立 Databricks Repo

以下是 DatabricksReposCreateOperator 的範例用法

tests/system/databricks/example_databricks_repos.py[原始碼]

    # Example of creating a Databricks Repo
    repo_path = "/Repos/user@domain.com/demo-repo"
    git_url = "https://github.com/test/test"
    create_repo = DatabricksReposCreateOperator(task_id="create_repo", repo_path=repo_path, git_url=git_url)

這個條目有幫助嗎?