snow app validate

배포된 Snowflake Native App의 설치 스크립트에 대한 유효성 검사를 수행합니다.

구문

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

인자

없음

선택 사항

--package-entity-id TEXT

definition_version이 2 이상일 때 작동할 패키지 엔터티의 ID입니다.

--app-entity-id TEXT

definition_version이 2 이상일 때 작동할 애플리케이션 엔터티의 ID입니다.

-p, --project TEXT

Snowflake 프로젝트가 있는 경로입니다. 기본값은 현재 작업 디렉터리입니다.

--env TEXT

키=값 형식의 문자열. 템플릿에 사용되는 env 섹션의 변수를 재정의합니다. 기본값: [].

--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

config에서 정의된 연결 대신, 명령줄 매개 변수로 정의된 연결을 사용합니다. 기본값: 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

로그 수준 디버그 이상에 대한 로그 항목을 표시하며, 디버그 로그에는 추가 정보가 포함됩니다. 기본값: False.

--silent

콘솔로의 중간 출력을 끕니다. 기본값: False.

--help

이 명령에 대한 도움말 텍스트를 표시합니다.

사용법 노트

애플리케이션의 소스 스테이지에 있는 파일에 영향을 주지 않기 위해 이 명령은 애플리케이션 패키지 엔터티의 scratch_stage 를 사용하여 빈 스테이지를 만들고, 이 스테이지에 프로젝트 파일을 업로드하고, 유효성 검사를 실행하고, 스테이지를 삭제합니다.

유효성 검사는 오류와 경고를 별도로 반환합니다. 오류가 발생하면 명령이 종료 코드 1로 종료되지만, 경고는 그렇지 않습니다.

  • 다음 예제는 성공적인 유효성 검사에 대한 출력을 보여줍니다.

    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.
    
  • 다음 예제는 JSON 출력 형식을 사용하여 성공적인 유효성 검사에 대한 출력을 보여줍니다.

    snow app validate --format json
    
    Copy
    {
        "errors": [],
        "warnings": [],
        "status": "SUCCESS"
    }
    
  • 다음 예제는 유효성 검사에서 오류 및 경고가 발생했을 때 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"
    }