SET

Si applica a:check marked yes Databricks SQL check marked yes Databricks Runtime

Imposta un parametro di Azure Databricks a livello di sessione, restituisce il valore di un parametro esistente o restituisce tutti i parametri con valore e significato. Quando si usa Databricks Runtime, i parametri sono noti come proprietà SQL Conf.

Per impostare una variabile SQL, usare edizione Standard T VARIABLE.

Sintassi

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

Parametri

  • (nessuno)

    Si applica a:check marked yes Databricks SQL

    Restituisce la chiave e il valore dei parametri di Azure Databricks modificati.

  • -v

    Restituisce la chiave, il valore e il significato dei parametri esistenti.

  • parameter_key

    Restituisce il valore del parametro specificato.

  • parameter_key = parameter_value

    Imposta il valore per un determinato parametro. Se esiste un valore precedente per un determinato parametro, viene sottoposto a override dal nuovo valore.

Esempi sql di Databricks

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

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