SET

적용 대상:check marked yes Databricks SQL check marked yes Databricks 런타임

세션 수준에서 Azure Databricks 매개 변수설정하거나, 기존 매개 변수의 값을 반환하거나, 값과 의미가 있는 모든 매개 변수를 반환합니다. Databricks Runtime을 사용하는 경우 매개 변수를 SQL Conf 속성이라고 합니다.

SQL 변수를 설정하려면 SET VARIABLE사용합니다.

구문

SET
SET [ -v ]
SET parameter_key [ = parameter_value ]

매개 변수

  • (none)

    적용 대상:check marked yes Databricks SQL

    변경된 Azure Databricks 매개 변수의 키와 값을 출력합니다.

  • -v

    기존 매개 변수의 키, 값 및 의미를 출력합니다.

  • parameter_key

    지정한 매개 변수의 값을 반환합니다.

  • parameter_key = parameter_value

    지정된 매개 변수의 값을 설정합니다. 지정된 매개 변수에 대한 이전 값이 있으면 새 값으로 재정의됩니다.

Databricks SQL 예제

-- Set a property.
> SET ansi_mode = true;

-- List all configuration parameters with their value and description.
> SET -v;

-- List all configuration parameters with a set value for the current session.
> SET;

-- List the value of specified property key.
> SET ansi_mode;
  key        value
  ---------  -----
  ansi_mode  true

-- Use SET VARIABLE to set SQL variables
> DECLARE var INT;
> SET var = 5;
Error: UNSUPPORTED_FEATURE.SET_VARIABLE_USING_SET
> SET VAR var = 5;
> SELECT var;
  5

Databricks Runtime 예제

-- Set a property.
> SET spark.sql.variable.substitute=false;

-- List all SQLConf properties with value and meaning.
> SET -v;

-- List all SQLConf properties with value for current session.
> SET;

-- List the value of specified property key.
> SET spark.sql.variable.substitute;
                           key value
 ----------------------------- -----
 spark.sql.variable.substitute false