snow app validate

Valida o script de configuração de um Snowflake Native App implementado.

Sintaxe

snow app validate
  --package-entity-id <package_entity_id>
  --app-entity-id <app_entity_id>
  --project <project_definition>
  --env <env_overrides>
  --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
Copy

Argumentos

Nenhum

Opções

--package-entity-id TEXT

O ID da entidade do pacote no qual a operação é feita quando definition_version for 2 ou superior.

--app-entity-id TEXT

O ID da entidade do aplicativo no qual a operação é feita quando definition_version for 2 ou superior.

-p, --project TEXT

Caminho onde o projeto Snowflake está. O padrão é o diretório de trabalho atual.

--env TEXT

Cadeia de caracteres no formato chave=valor. Substitui variáveis da seção env usadas para modelos. Padrão: [].

--connection, -c, --environment TEXT

Nome da conexão, conforme definido no arquivo config.toml. Padrão: padrão.

--host TEXT

Endereço do host da conexão. Substitui o valor especificado para a conexão.

--port INTEGER

Porta para a conexão. Substitui o valor especificado para a conexão.

--account, --accountname TEXT

Nome atribuído à sua conta Snowflake. Substitui o valor especificado para a conexão.

--user, --username TEXT

Nome de usuário para se conectar ao Snowflake. Substitui o valor especificado para a conexão.

--password TEXT

Senha do Snowflake. Substitui o valor especificado para a conexão.

--authenticator TEXT

Autenticador Snowflake. Substitui o valor especificado para a conexão.

--private-key-file, --private-key-path TEXT

Caminho do arquivo de chave privada Snowflake. Substitui o valor especificado para a conexão.

--token-file-path TEXT

Caminho para o arquivo com um token OAuth que deve ser usado ao conectar-se ao Snowflake.

--database, --dbname TEXT

Banco de dados a ser usado. Substitui o valor especificado para a conexão.

--schema, --schemaname TEXT

Esquema de banco de dados a ser usado. Substitui o valor especificado para a conexão.

--role, --rolename TEXT

Função a ser usada. Substitui o valor especificado para a conexão.

--warehouse TEXT

Warehouse a ser usado. Substitui o valor especificado para a conexão.

--temporary-connection, -x

Usa conexão definida com parâmetros de linha de comando, em vez de uma definida na configuração. Padrão: falso.

--mfa-passcode TEXT

Token a ser usado para autenticação multifator (MFA).

--enable-diag

Execução do teste de diagnóstico do conector Python. Padrão: falso.

--diag-log-path TEXT

Caminho do relatório de diagnóstico. Padrão: <temporary_directory>.

--diag-allowlist-path TEXT

Caminho do relatório de diagnóstico para a lista de permissões opcional.

--format [TABLE|JSON]

Especifica o formato de saída. Padrão: TABLE.

--verbose, -v

Exibe entradas de log para níveis de log info e superior. Padrão: falso.

--debug

Exibe entradas de log para níveis de log de depuração e superiores; os logs de depuração contêm informações adicionais. Padrão: falso.

--silent

Desliga a saída intermediária para o console. Padrão: falso.

--help

Exibe o texto de ajuda para este comando.

Notas de uso

Para evitar afetar arquivos no estágio de origem do aplicativo, este comando usa a entidade scratch_stage do pacote de aplicativo para criar um estágio em branco, carregar arquivos de projeto neste estágio, executar a validação e descartar o estágio.

A validação retorna erros e avisos separadamente. Erros fazem com que o comando saia com um código de saída 1, mas avisos não.

Exemplos

  • O exemplo a seguir mostra a saída para uma validação bem-sucedida:

    snow app validate
    
    Copy
    Validating Snowflake Native App setup script.
      Checking if stage st_version_pkg_<user>.app_src.stage_snowflake_cli_scratch exists, or creating a new one if none exists.
      Performing a diff between the Snowflake stage and your local deploy_root ('<APP_PATH>/apps/st-version/output/deploy') directory.
      There are no new files that exist only on the stage.
    There are no existing files that have been modified, or their status is unknown.
    There are no existing files that are identical to the ones on the stage.
    New files only on your local:
    README.md
    manifest.yml
    setup_script.sql
    streamlit/environment.yml
    streamlit/ui.py
      Uploading diff-ed files from your local <APP_PATH>/apps/st-version/output/deploy directory to the Snowflake stage.
      Dropping stage st_version_pkg_<user>.app_src.stage_snowflake_cli_scratch.
    Snowflake Native App validation succeeded.
    
  • O exemplo a seguir mostra a saída para uma validação bem-sucedida, usando o formato de saída JSON:

    snow app validate --format json
    
    Copy
    {
        "errors": [],
        "warnings": [],
        "status": "SUCCESS"
    }
    
  • O exemplo a seguir mostra a saída quando a validação encontra erros e avisos, usando o formato de saída JSON:

    snow app validate --format json
    
    Copy
    {
        "errors": [
            {
                "message": "Error in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/empty.sql': Empty SQL statement.",
                "cause": "Empty SQL statement.",
                "errorCode": "000900",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/empty.sql",
                "line": -1,
                "column": -1
            },
            {
                "message": "Error in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/second.sql': Unsupported feature 'CREATE VERSIONED SCHEMA without OR ALTER'.",
                "cause": "Unsupported feature 'CREATE VERSIONED SCHEMA without OR ALTER'.",
                "errorCode": "000002",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/second.sql",
                "line": -1,
                "column": -1
            },
            {
                "message": "Error in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql': File '/does-not-exist.sql' cannot be found in the same stage as the setup script is located.",
                "cause": "File '/does-not-exist.sql' cannot be found in the same stage as the setup script is located.",
                "errorCode": "093159",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql",
                "line": -1,
                "column": -1
            }
        ],
        "warnings": [
            {
                "message": "Warning in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql' on line 11 at position 35: APPLICATION ROLE should be created with IF NOT EXISTS.",
                "cause": "APPLICATION ROLE should be created with IF NOT EXISTS.",
                "errorCode": "093352",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql",
                "line": 11,
                "column": 35
            },
            {
                "message": "Warning in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql' on line 15 at position 13: CREATE Table statement in the setup script should have \"IF NOT EXISTS\", \"OR REPLACE\", or \"OR ALTER\".",
                "cause": "CREATE Table statement in the setup script should have \"IF NOT EXISTS\", \"OR REPLACE\", or \"OR ALTER\".",
                "errorCode": "093351",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql",
                "line": 15,
                "column": 13
            },
            {
                "message": "Warning in file '@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql' on line 15 at position 13: Table identifier 'MY_TABLE' should include its parent schema name.",
                "cause": "Table identifier 'MY_TABLE' should include its parent schema name.",
                "errorCode": "093353",
                "fileName": "@STAGE_SNOWFLAKE_CLI_SCRATCH/setup_script.sql",
                "line": 15,
                "column": 13
            }
        ],
        "status": "FAIL"
    }