SET

Se aplica a:check marked yes Databricks SQL check marked yes Databricks Runtime

Establece un parámetro de Azure Databricks en el nivel de sesión, devuelve el valor de un parámetro existente, o devuelve todos los parámetros con valor y significado. Al usar Databricks Runtime, los parámetros se conocen como propiedades de SQL Conf.

Para establecer una variable SQL, use SET VARIABLE.

Sintaxis

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

Parámetros

  • (none)

    Se aplica a:check marked yes Databricks SQL

    Genera la clave y el valor de los parámetros de Azure Databricks modificados.

  • -v

    Genera la clave, el valor y el significado de los parámetros existentes.

  • parameter_key

    Devuelve el valor del parámetro especificado.

  • parameter_key = parameter_value

    Establece el valor de un parámetro determinado. Si existe un valor antiguo para un parámetro determinado, el nuevo valor lo invalida.

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

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