DatabricksReposCreateOperator¶
使用 DatabricksReposCreateOperator 來建立(並可選地簽出)一個 Databricks Repos,透過 api/2.0/repos API 端點。
使用運算子¶
要使用此運算子,您至少需要提供 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 路徑,例如, |
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)