SET

S’applique à :check marked yes Databricks SQL check marked yes Databricks Runtime

Définit un paramètre Azure Databricks au niveau de la session, renvoie la valeur d’un paramètre existant ou renvoie tous les paramètres avec une valeur et une signification. Lorsque vous utilisez Databricks Runtime, les paramètres sont appelés propriétés SQL Conf.

Pour définir une variable SQL, utilisez SET VARIABLE.

Syntaxe

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

Paramètres

  • (none)

    S’applique à :check marked yes Databricks SQL

    Génère la clé et la valeur des paramètres modifiés d’Azure Databricks.

  • -v

    Génère la clé, la valeur et la signification des paramètres existants.

  • parameter_key

    Retourne la valeur du paramètre spécifié.

  • parameter_key = parameter_value

    Définit la valeur d’un paramètre donné. Si une ancienne valeur existe pour un paramètre donné, elle est remplacée par la nouvelle valeur.

Exemples 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

Exemples 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