snow git setup¶
设置 Git 存储库对象。
语法¶
snow git setup
<repository_name>
--connection <connection>
--host <host>
--port <port>
--account <account>
--user <user>
--password <password>
--authenticator <authenticator>
--private-key-file <private_key_file>
--token-file-path <token_file_path>
--database <database>
--schema <schema>
--role <role>
--warehouse <warehouse>
--temporary-connection
--mfa-passcode <mfa_passcode>
--enable-diag
--diag-log-path <diag_log_path>
--diag-allowlist-path <diag_allowlist_path>
--format <format>
--verbose
--debug
--silent
实参¶
repository_name
git 存储库的标识符;例如:my_repo。
选项¶
--connection, -c, --environment TEXT
连接名称,如您在
config.toml
文件中所定义。默认值:default
。--host TEXT
连接的主机地址。替换为连接指定的值。
--port INTEGER
连接的端口。替换为连接指定的值。
--account, --accountname TEXT
分配给 Snowflake 账户的名称。替换为连接指定的值。
--user, --username TEXT
连接到 Snowflake 的用户名。替换为连接指定的值。
--password TEXT
Snowflake 密码。替换为连接指定的值。
--authenticator TEXT
Snowflake 身份验证器。替换为连接指定的值。
--private-key-file, --private-key-path TEXT
Snowflake 私钥文件路径。替换为连接指定的值。
--token-file-path TEXT
连接到 Snowflake 时应使用的带有 OAuth 令牌的文件路径。
--database, --dbname TEXT
要使用的数据库。替换为连接指定的值。
--schema, --schemaname TEXT
要使用的数据库架构。替换为连接指定的值。
--role, --rolename TEXT
要使用的角色。替换为连接指定的值。
--warehouse TEXT
要使用的仓库。替换为连接指定的值。
--temporary-connection, -x
使用用命令行参数定义的连接,而不是在配置中定义的连接。默认值:False。
--mfa-passcode TEXT
用于多重身份验证的令牌 (MFA)。
--enable-diag
运行 Python 连接器诊断测试。默认值:False。
--diag-log-path TEXT
诊断报告路径。默认:<temporary_directory>。
--diag-allowlist-path TEXT
可选允许列表的诊断报告路径。
--format [TABLE|JSON]
指定输出格式。默认:TABLE。
--verbose, -v
显示日志级别
info
及更高级别的日志条目。默认值:False。--debug
显示日志级别
debug
及更高级别的日志条目;调试日志包含其他信息。默认值:False。--silent
关闭到控制台的中间输出。默认值:False。
--help
显示此命令的帮助文本。
使用说明¶
snow git setup
命令提示符用于以下信息:
URL:用于
git clone
操作的存储库地址。密钥:包含身份验证凭据的 Snowflake 密钥。如果源存储库不需要对只读操作(如克隆和提取)进行身份验证,则不需要。
API 集成:允许 Snowflake 与 Git 存储库交互的对象。
如果在 连接 中指定的角色或用户未被授予,执行此命令将生成类似于以下内容的错误:
003001 (42501): 01b2f095-0508-c66d-0001-c1be009a66ee: SQL access control error: Insufficient privileges to operate on account XXX
在这种情况下,您应检查您的连接配置或请求您的账户管理员授予您必要的权限或为您创建集成。有关更多信息,请参阅 创建用于与存储库 API 进行交互的 API 集成。
示例¶
创建需要密钥和凭据的存储库:
$ snow git setup snowcli_git Origin url: https://github.com/snowflakedb/snowflake-cli.git Use secret for authentication? [y/N]: y Secret identifier (will be created if not exists) [snowcli_git_secret]: new_secret Secret 'new_secret' will be created username: john_doe password/token: **** API integration identifier (will be created if not exists) [snowcli_git_api_integration]:
Secret 'new_secret' successfully created. API integration snowcli_git_api_integration successfully created. +------------------------------------------------------+ | status | |------------------------------------------------------| | Git Repository SNOWCLI_GIT was successfully created. | +------------------------------------------------------+
创建一个没有密钥和现有 API 集成 ID 的存储库:
$ snow git setup snowcli_git Origin url: https://github.com/snowflakedb/snowflake-cli.git Use secret for authentication [y/N]: n API integration identifier (will be created if not exists) [snowcli_git_api_integration]: EXISTING_INTEGRATION
Using existing API integration 'EXISTING_INTEGRATION'. +------------------------------------------------------+ | status | |------------------------------------------------------| | Git Repository SNOWCLI_GIT was successfully created. | +------------------------------------------------------+