|
13 | 13 | column_name,
|
14 | 14 | mask_name,
|
15 | 15 | using_columns
|
16 |
| - FROM `{{ relation.database|lower }}`.information_schema.column_masks |
| 16 | + FROM `system`.`information_schema`.`column_masks` |
17 | 17 | WHERE table_catalog = '{{ relation.database|lower }}'
|
18 | 18 | AND table_schema = '{{ relation.schema|lower }}'
|
19 | 19 | AND table_name = '{{ relation.identifier|lower }}';
|
20 | 20 | {%- endmacro -%}
|
21 | 21 |
|
22 |
| -{% macro apply_column_masks_from_model_columns(relation) -%} |
23 |
| - {% if relation.is_hive_metastore() %} |
24 |
| - {{ exceptions.raise_compiler_error("Column masks are not supported for Hive Metastore") }} |
25 |
| - {%- endif %} |
26 |
| - {{ log("Applying column masks from model to relation " ~ relation) }} |
27 |
| - {% set columns = model.get('columns', {}) %} |
28 |
| - {% for column_name, column_def in columns.items() %} |
29 |
| - {% if column_def is mapping and column_def.get('column_mask') %} |
30 |
| - {%- call statement('main') -%} |
31 |
| - {{ alter_set_column_mask(relation, column_name, column_def.column_mask) }} |
32 |
| - {%- endcall -%} |
33 |
| - {% endif %} |
34 |
| - {% endfor %} |
35 |
| -{%- endmacro -%} |
36 |
| - |
37 | 22 | {% macro apply_column_masks(relation, column_masks) -%}
|
38 | 23 | {% if relation.is_hive_metastore() %}
|
39 | 24 | {{ exceptions.raise_compiler_error("Column masks are not supported for Hive Metastore") }}
|
|
56 | 41 | {%- endmacro -%}
|
57 | 42 |
|
58 | 43 | {% macro alter_drop_column_mask(relation, column) -%}
|
59 |
| - ALTER TABLE {{ relation.render() }} |
| 44 | + ALTER {{ relation.type }} {{ relation.render() }} |
60 | 45 | ALTER COLUMN {{ column }}
|
61 | 46 | DROP MASK;
|
62 | 47 | {%- endmacro -%}
|
63 | 48 |
|
64 | 49 | {% macro alter_set_column_mask(relation, column, mask) -%}
|
65 |
| - ALTER TABLE {{ relation.render() }} |
| 50 | + ALTER {{ relation.type }} {{ relation.render() }} |
66 | 51 | ALTER COLUMN {{ column }}
|
67 | 52 | SET MASK {{ mask.function }}
|
68 | 53 | {%- if mask.using_columns %}
|
|
0 commit comments