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)