사용자 지정 클린룸 템플릿 참조

Clean Room 템플릿 정보

Clean room templates are written in JinjaSQL. JinjaSQL is an extension to the Jinja templating language that generates a SQL query as output. This allows templates to use logic statements and run-time variable resolution to let the user specify table names, table columns, and custom values used in the query at run time.

Snowflake provides some pre-designed templates for common use cases. However, most users prefer to create custom query templates for their clean rooms. Custom templates are created using the clean rooms API, but can be run either in code or using the clean rooms UI.

템플릿에는 일반적으로 두 가지 유형이 있습니다.

  • Analysis templates, which evaluate to a SELECT statement (or a set of SELECT operations) that show results to the template runner.

  • Activation templates, which are used to activate results to a Snowflake account or a third-party, rather than showing results in the immediate environment. An activation template is very similar to an analysis template with a few extra requirements.

    In the clean rooms UI, an analysis template can be associated with an activation template to enable the caller to run an analysis, see results, and then activate data to themselves or a third party. The activation template does not need to resolve to the same query as the associated analysis template.

사용자 지정 템플릿 만들기 및 실행하기

In a clean room with default settings, the provider adds a template to a clean room and the consumer runs the template, as described in the custom template usage documentation.

간단한 예

다음은 이메일을 통해 공급자와 컨슈머 테이블을 조인하고 도시별 중복 수를 보여주는 간단한 SQL 예제입니다.

SELECT COUNT(*), city FROM consumer_table
  INNER consumer_table
  ON consumer_table.hashed_email = provider_table.hashed_email
  GROUP BY city;
Copy

Here is how that query would look as a JinjaSQL template that allows the caller to choose the JOIN and GROUP BY columns, as well as the tables used:

SELECT COUNT(*), IDENTIFIER({{ group_by_col | column_policy }})
  FROM IDENTIFIER({{ my_table[0] }}) AS c
  INNER JOIN IDENTIFIER({{ source_table[0] }}) AS p
  ON IDENTIFIER({{ consumer_join_col | join_policy }}) = IDENTIFIER({{ provider_join_col | join_policy }})
  GROUP BY IDENTIFIER({{ group_by_col | column_policy }});
Copy

템플릿에 대한 참고 사항:

  • {{ double bracket pairs }} 내의 값은 사용자 지정 변수입니다. group_by_col, my_table, source_table, consumer_join_col, provider_join_col, group_by_col 은 모두 호출자에 의해 채워지는 사용자 지정 변수입니다.

  • source_tablemy_table 은 호출자에 의해 채워지는 Snowflake 정의 문자열 배열 변수입니다. 배열 멤버는 Clean Room에 연결된 공급자 및 컨슈머 테이블의 정규화된 이름입니다. 호출자는 각 배열에 포함할 테이블을 지정합니다.

  • Provider tables must be aliased as lowercase p and consumer tables as lowercase c in a template. If you have multiple tables, you can index them as p1, p2, c1, c2, and so on.

  • {{ double brackets }} 의 변수는 유효한 식별자가 아닌 문자열 리터럴로 평가되므로 모든 열 및 테이블 이름에 IDENTIFIER 가 필요합니다.

  • JinjaSQL filters can be applied to variables to enforce any join or column policies set by either side. Snowflake implements custom filters join_policy and column_policy, which verify whether a column complies with join or column policies in the clean room respectively, and fail the query if it does not. A filter is applied to a column name as {{ column_name | filter_name }}.

이 모든 사항은 나중에 자세히 설명하겠습니다.

컨슈머가 이 템플릿을 코드에서 실행하는 방법은 다음과 같습니다. 템플릿에 선언된 테이블 별칭으로 열 이름이 한정되는 방식에 유의하십시오.

CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.CONSUMER.RUN_ANALYSIS(
  $cleanroom_name,
  $template_name,
  ['my_db.my_sch.consumer_table],       -- Populates the my_table variable
  ['my_db.my_sch.provider_table'],      -- Populates the source_table variable
  OBJECT_CONSTRUCT(                     -- Populates custom named variables
    'consumer_join_col','c.age_band',
    'provider_join_col','p.age_band',
    'group_by_col','p.device_type'
  )
);
Copy

To be able to use this template in the clean rooms UI, the provider must create a custom UI form for the template. The UI form has named form elements that correspond to template variable names, and the values provided in the form are passed into the template.

사용자 지정 템플릿 개발

클린룸 템플릿은 JinjaSQL 템플릿입니다. 템플릿을 만들려면 다음 항목을 숙지해야 합니다.

Use the consumer.get_jinja_sql procedure to test the validity of your template, then run the rendered template to see that it produces the results that you expect. Note that this procedure doesn’t support clean room filter extensions, such as join_policy, so you must test your template without those filters, and add them later.

예:

-- Template to test
SELECT {{ col1 | sqlsafe }}, {{ col2 | sqlsafe }}
  FROM IDENTIFIER({{ source_table[0] }}) AS p
  JOIN IDENTIFIER({{ my_table[0] }}) AS c
  ON {{ provider_join_col | sqlsafe }} = {{ consumer_join_col | sqlsafe}}
  {% if where_phrase %} WHERE {{ where_phrase | sqlsafe}}{% endif %};

-- Render the template.
USE WAREHOUSE app_wh;
USE ROLE SAMOOHA_APP_ROLE;

CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.CONSUMER.GET_SQL_JINJA(
$$
SELECT {{ col1 | sqlsafe }}, {{ col2 | sqlsafe }}
  FROM IDENTIFIER({{ source_table[0] }}) AS p
  JOIN IDENTIFIER({{ my_table[0] }}) AS c
  ON IDENTIFIER({{ provider_join_col }}) = IDENTIFIER({{ consumer_join_col }})
  {% if where_phrase %} WHERE {{ where_phrase | sqlsafe }}{% endif %};
  $$,
  object_construct(
'col1', 'c.status',
'col2', 'c.age_band',
'where_phrase', 'p.household_size > 2',
'consumer_join_col', 'c.age_band',
'provider_join_col', 'p.age_band',
'source_table', ['SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS'],
'my_table', ['SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS']
));
Copy

The rendered template looks like this:

SELECT c.status, c.age_band
  FROM IDENTIFIER('SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS') AS p
  JOIN IDENTIFIER('SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS') AS c
  ON p.age_band = c.age_band
  WHERE p.household_size > 2;

Try running the SQL statement above in your environment to see if it works, and gets the expected results.

Then test your template without a WHERE clause:

-- Render the template without a WHERE clause
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.CONSUMER.GET_SQL_JINJA(
$$
SELECT {{ col1 | sqlsafe }}, {{ col2 | sqlsafe }}
  FROM IDENTIFIER({{ source_table[0] }}) AS p
  JOIN IDENTIFIER({{ my_table[0] }}) AS c
  ON {{ provider_join_col | sqlsafe }} = {{ consumer_join_col | sqlsafe}}
  {% if where_phrase %} WHERE {{ where_phrase | sqlsafe }}{% endif %};
  $$,
  object_construct(
'col1', 'c.status',
'col2', 'c.age_band',
'consumer_join_col', 'c.age_band',
'provider_join_col', 'p.age_band',
'source_table', ['SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS'],
'my_table', ['SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS']
));
Copy

Rendered template:

SELECT c.status, c.age_band
  FROM IDENTIFIER('SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS') AS p
  JOIN IDENTIFIER('SAMOOHA_SAMPLE_DATABASE.DEMO.CUSTOMERS') AS c
  ON p.age_band = c.age_band
  ;

Add the policy filters to the template, and add the template to your clean room:

CALL samooha_by_snowflake_local_db.provider.add_custom_sql_template(
    $cleanroom_name,
    'simple_template',
    $$
    SELECT {{ col1 | sqlsafe | column_policy }}, {{ col2 | sqlsafe | column_policy }}
      FROM IDENTIFIER({{ source_table[0] }}) AS p
      JOIN IDENTIFIER({{ my_table[0] }}) AS c
      ON {{ provider_join_col | sqlsafe | join_policy }} = {{ consumer_join_col | sqlsafe | join_policy }}
      {% if where_phrase %} WHERE {{ where_phrase | sqlsafe }}{% endif %};
    $$,
);
Copy

데이터 보호

템플릿은 공급자와 컨슈머가 Clean Room에 연결한 데이터 세트에만 액세스할 수 있습니다.

Both the provider and consumer can set join, column, and activation policies on their data to protect which columns can be joined on, projected, or activated; however, the template must include the appropriate JinjaSQL policy filter on a column for the policy to be applied.

사용자 지정 템플릿 구문

Snowflake Data Clean Rooms는 V3 JinjaSQL 을 지원하며, 몇 가지 확장 프로그램이 있습니다.

템플릿 명명 규칙

When creating a template, names must be all lowercase letters, numbers, spaces, or underscores. Activation templates (except for consumer-run provider activation) must have a name beginning with activation_. Template names are assigned when you call provider.add_custom_sql_template or consumer.create_template_request.

유효한 이름의 예:

  • my_template

  • activation_template_1

유효하지 않은 이름의 예:

  • my template - 허용되지 않는 공백

  • My_Template - 소문자 템플릿만 허용됨

템플릿 변수

템플릿 호출자는 템플릿 변수에 값을 전달할 수 있습니다. JinjaSQL 구문을 사용하면 {{ double_brackets }} 내의 모든 변수 이름에 대해 변수 바인딩을 사용할 수 있지만, 아래에 설명된 대로 재정의해서는 안 되는 몇 가지 변수 이름이 Snowflake에 예약되어 있습니다.

조심

모든 변수는 Snowflake 정의이든 사용자 지정이든 사용자가 채우므로 적절한 주의를 기울여 다루어야 합니다. Snowflake Data Clean Rooms 템플릿은 단일 SELECT 문으로 해결되어야 하지만 모든 변수는 호출자가 전달한다는 점을 기억해야 합니다.

Snowflake 정의 변수

모든 Clean Room 템플릿은 Snowflake에 의해 정의되지만 호출자가 전달한 다음 전역 변수에 액세스할 수 있습니다.

source_table:

템플릿에서 사용할 수 있는 Clean Room의 공급자 연결된 테이블 및 뷰의 제로 기반 문자열 배열입니다. 테이블 이름은 정규화된 이름으로, my_db.my_sch.provider_customers 를 예로 들 수 있습니다.

예: SELECT col1 FROM IDENTIFIER({{ source_table[0] }}) AS p;

my_table:

템플릿에서 사용할 수 있는 Clean Room의 컨슈머 테이블 및 뷰의 제로 기반 문자열 배열입니다. 테이블 이름은 정규화된 이름으로, my_db.my_sch.consumer_customers 를 예로 들 수 있습니다.

예: SELECT col1 FROM IDENTIFIER({{ my_table[0] }}) AS c;

privacy:

A set of privacy-related values associated with users and templates. See the list of available child fields. These values can be set explicitly for the user, but you might want to set default values in the template. Access the child fields directly in your template, such as privacy.threshold.

예: 다음은 threshold_value 를 사용하여 집계 절에 최소 그룹 크기를 적용하는 템플릿의 예시 코드 조각입니다.

SELECT
  IFF(a.overlap > ( {{ privacy.threshold_value | default(2)  | sqlsafe }} ),
                    a.overlap,1 ) AS overlap,
  c.total_count AS total_count
  ...
Copy
measure_column:

dimensions:

where_clause:

Legacy clean room global variables. They are no longer recommended for use, but are still defined and appear in some legacy templates and documentation, so you should not alias tables or columns using either of these names to avoid naming collisions.

If your template uses measure_column or dimensions, the column policy is checked against any columns passed into these variables.

If your template uses a where_clause that has a join condition (for example, table1.column1 = table2.column2), the join policy is checked against any columns named there; otherwise, the column policy is checked against any columns named there.

사용자 지정 변수

템플릿 작성자는 호출자가 채울 수 있는 임의의 변수를 템플릿에 포함할 수 있습니다. 이러한 변수는 Snowflake 정의 변수 또는 테이블 별칭 이름을 제외하고 임의의 Jinja 호환 이름을 가질 수 있습니다. 템플릿을 클린룸 UI에서 사용할 수 있도록 하려면 클린룸 UI 사용자를 위한 UI 양식도 제공해야 합니다. API 사용자의 경우 필수 및 선택 변수에 대한 자세한 설명서를 제공해야 합니다.

사용자 지정 변수는 템플릿에서 액세스할 수 있습니다(예: 사용자 지정 변수 max_income).

SELECT income FROM my_db.my_sch.customers WHERE income < {{ max_income }};
Copy

사용자는 두 가지 방법으로 템플릿에 변수를 전달할 수 있습니다.

  • 클린룸 UI에서 템플릿 개발자가 만든 UI 양식을 통해 값을 선택하거나 제공합니다. 이 UI 양식에는 사용자가 템플릿에 대한 값을 제공할 수 있는 양식 요소가 포함되어 있습니다. 양식 요소의 이름은 변수의 이름입니다. 템플릿은 단순히 양식 요소의 이름을 사용하여 값에 액세스합니다. :ref:`provider.add_ui_form_customizations<dcr_provider_add_ui_form_customizations>`를 사용하여 UI 양식을 만듭니다.

  • 코드에서 컨슈머가 consumer.run_analysis 를 호출하고 테이블 이름을 인자 배열로, 사용자 지정 변수를 이름-값 페어로 analysis_arguments 인자에 전달합니다.

참고

If you need to access user-provided values in any custom Python code uploaded to the clean room, you must explicitly pass variable values in to the code through Python function arguments; template variables are not directly accessible within the Python code using {{jinja variable binding syntax}}.

변수를 올바르게 해결하기

템플릿에 전달된 문자열 값은 최종 템플릿에서 문자열 리터럴로 해석됩니다. 바인딩된 변수를 적절하게 처리하지 않으면 SQL 구문 분석 또는 논리적 오류가 발생할 수 있습니다.

  • SELECT {{ my_col }} FROM P; - This resolves to SELECT 'my_col' from P; which simply returns the string “my_col” - probably not what you want.

  • SELECT age FROM {{ my_table[0] }} AS P; - This resolves to SELECT age FROM 'somedb.somesch.my_table' AS P;, which causes a parsing error because a table must be an identifier, not a literal string.

  • SELECT age FROM IDENTIFIER({{ my_table[0] }}) AS P {{ where_clause }}; - Passing in “WHERE age < 50” evaluates to SELECT age FROM mytable AS P 'WHERE age < 50';, which is a parsing error because of the literal string WHERE clause.

따라서 적절한 경우 변수를 해결해야 합니다. 템플릿에서 변수를 올바르게 해결하는 방법은 다음과 같습니다.

Resolving table and column names

테이블 또는 열 이름을 지정하는 변수는 템플릿에서 두 가지 방법 중 하나를 사용하여 식별자로 변환해야 합니다.

  • IDENTIFIER: 예: SELECT IDENTIFIER({{ my_column }}) FROM P;

  • sqlsafe: 이 JinjaSQL 필터는 식별자 문자열을 SQL 텍스트로 변환합니다. 이전 글머리 기호에 해당하는 문은 SELECT {{ my_column | sqlsafe }} FROM P; 입니다.

특정 사용법에 따라 IDENTIFIER 또는 sqlsafe 를 사용해야 하는 시기가 결정됩니다. 예를 들어 c.{{ my_column | sqlsafe }} 는 IDENTIFIER 를 사용하여 쉽게 다시 작성할 수 없습니다.

Resolving dynamic SQL

WHERE 절과 같이 리터럴 SQL 로 사용해야 하는 문자열 변수가 있는 경우 템플릿에서 sqlsafe 필터를 사용하십시오. 예:

SELECT age FROM IDENTIFIER({{ my_table[0] }}) AS C WHERE {{ where_clause }};
Copy

사용자가 “age < 50”을 where_clause 에 전달하면 쿼리는 리터럴 문자열 WHERE 조건 때문에 유효하지 않은 SQL 인 SELECT age FROM sometable AS C WHERE 'age < 50'; 으로 확인됩니다. 이 경우 sqlsafe 필터를 사용해야 합니다.

SELECT age FROM IDENTIFIER( {{ my_table[0] }} ) as c {{ where_clause | sqlsafe }};
Copy

필수 테이블 별칭

At the top level of your query, all tables or subqueries must be aliased as either p (for provider-tables) or c (for consumer tables) in order for Snowflake to validate join and column policies correctly in the query. Any column that must be verified against join or column policies must be qualified with the lowercase p or c table alias. (Specifying p or c tells the back end whether to validate a column against the provider or the consumer policy respectively.)

If you use multiple provider or consumer tables in your query, add a numeric, sequential 1-based suffix to each table alias after the first. So: p, p1, p2, and so on for the first, second, and third provider tables, and c, c1, c2, and so on for the first, second, and third consumer tables. The p or c index should be sequential without gaps (that is, create the aliases p, p1, and p2, not p, p2, and p4).

SELECT p.col1 FROM IDENTIFIER({{ source_table[0] }}) AS P
UNION
SELECT p1.col1 FROM IDENTIFIER({{ source_table[1] }}) AS P1;
Copy

Custom clean room template filters

Snowflake는 모든 표준 Jinja 필터 및 대부분의 표준 JinjaSQL 필터 를 몇 가지 확장 프로그램과 함께 지원합니다.

  • join_policy: Succeeds if the column is in the join policy of the data owner; fails otherwise.

  • column_policy: Succeeds if the column is in the column policy of the data owner; fails otherwise.

  • activation_policy: Succeeds if the column is in the activation policy of the data owner; fails otherwise.

  • join_and_column_policy: Succeeds if the column is in the join or column policy of the data owner; fails otherwise.

  • Snowflake 템플릿에서는 identifier JinjaSQL 필터가 지원되지 않습니다.

JinjaSQL 문은 왼쪽에서 오른쪽으로 평가됩니다.

  • {{ my_col | column_policy }} 정답

  • {{ my_col | sqlsafe | column_policy }} 정답

  • {{ column_policy | my_col }} 오답

  • {{ my_col | column_policy | sqlsafe }} 잘못됨: column_policy``는 문자열로 ``my_col 값과 비교되며, 이는 오류입니다.

Clean Room 정책 적용하기

Clean rooms do not automatically check clean room policies against columns used in a template. If you want to enforce a policy against a column:

  • You must apply the appropriate policy filter to that column in the template. For example:

JOIN IDENTIFIER({{ source_table[0] }}) AS p
  ON IDENTIFIER({{ c_join_col | join_policy }}) = IDENTIFIER({{ p_join_col | join_policy }})
Copy

Policies are checked only against columns owned by other collaborators; policies are not checked for your own data.

Note that column names cannot be ambiguous when testing policies. So if you have columns with the same name in two tables, you must qualify the column name in order to test the policy against that column.

사용자 지정 Python 코드 실행하기

템플릿은 Clean Room에 업로드된 Python 코드를 실행할 수 있습니다. 템플릿은 데이터 행에서 값을 받아 쿼리에서 사용하거나 투영할 값을 반환하는 Python 함수를 호출할 수 있습니다.

  • **공급자**가 사용자 지정 Python 코드를 클린룸에 업로드하면 템플릿은 구문 cleanroom.function_name`을 사용하여 Python 함수를 호출합니다. :doc:`자세한 내용은 여기를 참조하세요.</user-guide/cleanrooms/demo-flows/custom-code>

  • **컨슈머**가 사용자 지정 Python 코드를 클린룸에 업로드하면 템플릿은 consumer.generate_python_request_template``에 전달된 베어 ``function_name 값으로 함수를 호출합니다(공급자 코드와 같이 cleanroom`으로 범위가 지정되지 않음). :doc:`자세한 내용은 여기를 참조하세요.</user-guide/cleanrooms/demo-flows/custom-code>

공급자 코드 예시:

-- Provider uploads a Python function that takes two numbers and returns the sum.
CALL samooha_by_snowflake_local_db.provider.load_python_into_cleanroom(
  $cleanroom_name,
  'simple_addition',                        -- Function name to use in the template
  ['someval integer', 'added_val integer'], -- Arguments
  [],                                       -- No packages needed
  'integer',                                -- Return type
  'main',                                   -- Handler for function name
  $$

def main(input, added_val):
  return input + int(added_val)
    $$
);

-- Template passes value from each row to the function, along with a
-- caller-supplied argument named 'increment'
CALL samooha_by_snowflake_local_db.provider.add_custom_sql_template(
    $cleanroom_name,
    'simple_python_example',
$$
    SELECT val, cleanroom.simple_addition(val, {{ increment | sqlsafe }})
    FROM VALUES (5),(8),(12),(39) AS P(val);
$$
);
Copy

보안 고려 사항

A clean room template is not executed with the identity of the current user.

사용자는 Clean Room 내의 데이터에 직접 액세스할 수 없으며, 모든 액세스는 템플릿 결과를 통해 기본 애플리케이션을 통해 이루어집니다.

Apply a policy filter any time a column is used in your template to ensure that your policies, and the policies of all collaborators, are respected.

Wrap user-provided variables with IDENTIFIER() when possible to strengthen your templates against SQL injection attacks.

활성화 템플릿

템플릿을 사용하여 쿼리 결과를 Clean Room 외부의 테이블에 저장할 수도 있습니다. 이를 활성화 라고 합니다. 현재 사용자 지정 템플릿에 지원되는 유일한 활성화 형태는 공급자 활성화와 컨슈머 활성화(각각 공급자 또는 컨슈머의 Snowflake 계정에 결과 저장)입니다. 활성화를 구현하는 방법에 대해 알아보십시오.

활성화 템플릿은 다음과 같은 추가 요구 사항이 있는 분석 템플릿입니다.

  • 활성화 템플릿은 단순한 SELECT 문일 수 있는 분석 템플릿과 달리 SQL 스크립트 블록으로 평가되는 JinjaSQL 문입니다.

  • Activation templates create a table in the clean room to store results, and return the table name (or a fragment of the name) to the template caller.

  • 스크립트 블록은 cleanroom. 또는 cleanroom.activation_data_ 접두사를 제외한 생성된 테이블의 이름을 반환하는 RETURN 문으로 끝나야 합니다.

  • The name of the template, the name of the internal table that the template creates, and the table name the template returns follow these patterns:

Activation type

Template name prefix

Table name prefix

Returned table name

Consumer-run consumer

activation_

cleanroom.activation_data_*

Table name without prefix

Consumer-run provider

No prefix required

cleanroom.activation_data_*

Table name without prefix

Provider-run provider

activation_

cleanroom.temp_result_data is the full table name.

temp_result_data

  • 활성화되는 모든 열은 데이터를 연결한 공급자 또는 컨슈머의 활성화 정책 에 나열되어야 하며, activation_policy 필터가 적용되어 있어야 합니다. 열은 활성화 열과 조인 열이 모두 될 수 있습니다.

  • 템플릿이 클린룸 UI에서 실행되는 경우, activation_template_nameenabled_activations 필드를 포함하는 :ref:`웹 양식을 제공<label-dcr_define_user_form>`해야 합니다. UI에서 사용할 템플릿에는 분석 템플릿과 연결된 활성화 템플릿이 모두 있어야 합니다.

  • 테이블이 생성되고 있으므로 계산된 모든 열은 추론된 이름이 아닌 명시적으로 별칭을 지정해야 합니다. 즉,

    SELECT COUNT(*), p.status from T AS P; FAILS, because the COUNT column name is inferred.

    SELECT COUNT(*) AS COUNT_OF_ITEMS, p.status from T AS P; SUCCEEDS, because it explicitly aliases the COUNT column.

다음은 두 가지 샘플 기본 활성화 템플릿입니다. 하나는 공급자 실행 서버 활성화용이고 다른 하나는 기타 활성화 유형용입니다. 결과 테이블 이름이 포함된 강조 표시된 두 줄이 다릅니다.

Table must be named cleanroom.temp_result_data:

BEGIN
  CREATE OR REPLACE TABLE cleanroom.temp_result_data AS
    SELECT COUNT(c.status) AS ITEM_COUNT, c.status, c.age_band
      FROM IDENTIFIER({{ my_table[0] }}) AS c
    JOIN IDENTIFIER({{ source_table[0] }}) AS p
      ON {{ c_join_col | sqlsafe | activation_policy }} = {{ p_join_col | sqlsafe | activation_policy }}
    GROUP BY c.status, c.age_band
    ORDER BY c.age_band;
  RETURN 'temp_result_data';
END;
Copy

다음 단계

템플릿 시스템을 마스터한 후에는 템플릿 유형으로 Clean Room을 구현하기 위한 세부 사항을 읽어보십시오.

  • 공급자 템플릿 은 공급자가 작성한 템플릿입니다. 이것이 기본 사용 사례입니다.

  • :ref:`컨슈머 템플릿<label-dcr_consumer_written_templates>`은 컨슈머가 작성한 템플릿입니다. 어떤 경우에는 클린룸 작성자가 컨슈머가 자체 템플릿을 만들고 클린룸에 업로드하고 실행할 수 있도록 하려고 합니다.

  • 활성화 템플릿 은 실행 성공 후 결과 테이블을 생성합니다. 활성화 템플릿에 따라 결과 테이블을 Clean Room 외부의 공급자 또는 컨슈머의 계정에 저장하거나 활성화 허브에 나열된 서드 파티 활성화 공급자로 보낼 수 있습니다.

  • 체인 템플릿 을 사용하면 여러 템플릿을 체인으로 연결하여 각 템플릿의 출력을 체인의 다음 템플릿에서 사용할 수 있습니다.

자세한 정보