Condividi tramite


SET RECIPIENT

Si applica a:selezionare sì contrassegnato come sìSQL di Databricks selezionare sì Databricks Runtime 15.1 e versioni successive

Imposta il CURRENT_RECIPIENT sul destinatario specificato nella sessione corrente per consentire al provider di simulare le proprietà di CURRENT_RECIPIENT. In questo modo i provider possono eseguire query sulle viste che contengono la funzione CURRENT_RECIPIENT.

Sintassi

SET RECIPIENT recipient_name

Parametri

  • recipient_name

    Nome del destinatario da impostare come destinatario corrente.

Esempi

— Creates new recipient
> CREATE RECIPIENT nasdaq PROPERTIES (‘country’ = ‘US’);

> CREATE TABLE my_table (country STRING, name STRING);
> INSERT INTO my_table VALUES (‘US’, ‘John’), (‘UK’, ‘Mary’);

> CREATE VIEW my_view AS
    SELECT * FROM my_table
    WHERE country = CURRENT_RECIPIENT('country');

— Sets current recipient
> SET RECIPIENT nasdaq;

> SELECT * FROM my_view;
  US         John