Skip to content

Commit e04dcf8

Browse files
authored
feat: support schema authorization adapter (#96)
1 parent 448969b commit e04dcf8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dbt/include/risingwave/macros/adapters.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@
4646
{{ return(load_result('list_relations_without_caching').table) }}
4747
{% endmacro %}
4848

49+
{% macro risingwave__create_schema(relation) -%}
50+
{% if relation.database -%}
51+
{{ adapter.verify_database(relation.database) }}
52+
{%- endif -%}
53+
54+
{%- set schema_owner = none -%}
55+
{%- if config is defined -%}
56+
{%- set configured_owner = config.get("schema_authorization", none) -%}
57+
{%- if configured_owner is not none and configured_owner | trim != "" -%}
58+
{%- set schema_owner = configured_owner -%}
59+
{%- endif -%}
60+
{%- endif -%}
61+
62+
{%- call statement('create_schema') -%}
63+
create schema if not exists {{ relation.without_identifier().include(database=False) }}
64+
{%- if schema_owner %}
65+
authorization {{ adapter.quote(schema_owner) }}
66+
{%- endif %}
67+
{%- endcall -%}
68+
{% endmacro %}
69+
4970
{% macro risingwave__get_columns_in_relation(relation) -%}
5071
{% call statement('get_columns_in_relation', fetch_result=True) %}
5172
select

0 commit comments

Comments
 (0)