SET RECIPIENT
适用于: Databricks SQL Databricks Runtime 15.1 及更高版本
将 CURRENT_RECIPIENT 设置为当前会话中的指定接收方,以允许提供程序模拟 CURRENT_RECIPIENT 属性。 这使提供程序能够查询包含 CURRENT_RECIPIENT 函数的视图。
语法
SET RECIPIENT recipient_name
参数
-
要设置为当前接收方的接收方的名称。
示例
— 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