snow init¶
使用模板创建项目目录。
语法
实参
path要使用项目进行初始化的目录。此目录不能已经存在。
选项
--template TEXTwhich template (subdirectory of –template-source) should be used. If not provided, whole source will be used as the template.
--template-source TEXTlocal path to template directory or URL to git repository with templates. Default: https://github.com/snowflakedb/snowflake-cli-templates (https://github.com/snowflakedb/snowflake-cli-templates).
--variable, -D TEXTString in key=value format. Provided variables will not be prompted for.
--no-interactive禁用提示。默认值:False。
--format [TABLE%JSON%JSON_EXT|CSV]指定输出格式。默认:TABLE。
--verbose, -vDisplays log entries for log levels info and higher. Default: False.
--debugDisplays log entries for log levels debug and higher; debug logs contain additional information. Default: False.
--silent关闭到控制台的中间输出。默认值:False。
--enhanced-exit-codes根据错误类型区分退出错误代码。默认值:False。
--decimal-precision INTEGERNumber of decimal places to display for decimal values. Uses Python’s default precision if not specified. [env var: SNOWFLAKE_DECIMAL_PRECISION].
--helpDisplays the help text for this command.
使用说明
The snow init command initializes a directory specified in the <path> parameter with a chosen template. It renders all files mentioned in the files_to_render list in the template.yml, resolving all variables enclosed in <! … !>. If a template.yml file is not present in the template’s root directory, the command finishes with an error. For information about creating project templates, see Bootstrapping a project from a template.
By default, the command interactively prompts you for each parameter defined in the template.yml file. You can bypass the interactive prompts in the following ways:
-
Use the
-Doption to specify the values for each parameter contained in the project template. -
Use the
--no-interactiveoption to use default values, if defined, for each template parameter in thetemplate.ymlfile. -
Use a combination of the
-Dand--no-interactiveoptions to define values for some parameters and use the specified default values for the template.Note
If you do not provide a value using the
-Doption that does not have a corresponding default value defined, the snow init command terminates with an error.
示例
-
Bootstrap a Snowpark project that prompts for the parameters specified in the
example_snowparktemplate contained in the snowflake-cli-templates Git repository (https://github.com/snowflakedb/snowflake-cli-templates/). -
Bootstrap a Streamlit project by using the
-Doption to provide the values for some of the parameters specified in the local../local_templates/example_streamlittemplate and prompt for others.