quollio-core 0.6.3__tar.gz → 0.6.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. {quollio_core-0.6.3 → quollio_core-0.6.5}/PKG-INFO +1 -1
  2. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/__init__.py +1 -1
  3. quollio_core-0.6.5/quollio_core/dbt_projects/snowflake/macros/materialization/divided_view.sql +103 -0
  4. quollio_core-0.6.3/quollio_core/dbt_projects/snowflake/macros/materialization/divided_view.sql +0 -87
  5. {quollio_core-0.6.3 → quollio_core-0.6.5}/LICENSE +0 -0
  6. {quollio_core-0.6.3 → quollio_core-0.6.5}/README.md +0 -0
  7. {quollio_core-0.6.3 → quollio_core-0.6.5}/pyproject.toml +0 -0
  8. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/bigquery.py +0 -0
  9. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/bricks.py +0 -0
  10. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/.gitignore +0 -0
  11. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/README.md +0 -0
  12. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/analyses/.gitkeep +0 -0
  13. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/dbt_project.yml +0 -0
  14. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/macros/.gitkeep +0 -0
  15. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/models/quollio_lineage_column_level.sql +0 -0
  16. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/models/quollio_lineage_column_level.yml +0 -0
  17. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/models/quollio_lineage_table_level.sql +0 -0
  18. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/models/quollio_lineage_table_level.yml +0 -0
  19. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/models/sources.yml +0 -0
  20. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/packages_hub.yml +0 -0
  21. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/packages_local.yml +0 -0
  22. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/profiles/profiles_template.yml +0 -0
  23. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/seeds/.gitkeep +0 -0
  24. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/databricks/snapshots/.gitkeep +0 -0
  25. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/README.md +0 -0
  26. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/analyses/.gitkeep +0 -0
  27. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/dbt_project.yml +0 -0
  28. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/macros/.gitkeep +0 -0
  29. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/macros/materialization/divided_view.sql +0 -0
  30. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_lineage_table_level.sql +0 -0
  31. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_lineage_table_level.yml +0 -0
  32. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_lineage_view_level.sql +0 -0
  33. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_lineage_view_level.yml +0 -0
  34. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_sqllineage_sources.sql +0 -0
  35. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_sqllineage_sources.yml +0 -0
  36. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_stats_columns.sql +0 -0
  37. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_stats_columns.yml +0 -0
  38. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_stats_profiling_columns.sql +0 -0
  39. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/quollio_stats_profiling_columns.yml +0 -0
  40. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/models/sources.yml +0 -0
  41. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/packages_hub.yml +0 -0
  42. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/packages_local.yml +0 -0
  43. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/profiles/profiles_template.yml +0 -0
  44. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/seeds/.gitkeep +0 -0
  45. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/redshift/snapshots/.gitkeep +0 -0
  46. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/seeds/.gitkeep +0 -0
  47. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/README.md +0 -0
  48. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/analyses/.gitkeep +0 -0
  49. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/dbt_project.yml +0 -0
  50. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/macros/.gitkeep +0 -0
  51. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/macros/materialization/get_imported_databases.sql +0 -0
  52. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_column_level.sql +0 -0
  53. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_column_level.yml +0 -0
  54. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_table_level.sql +0 -0
  55. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_table_level.yml +0 -0
  56. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_sqllineage_sources.sql +0 -0
  57. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_sqllineage_sources.yml +0 -0
  58. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_stats_columns.sql +0 -0
  59. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_stats_columns.yml +0 -0
  60. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_stats_profiling_columns.sql +0 -0
  61. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/quollio_stats_profiling_columns.yml +0 -0
  62. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/models/sources.yml +0 -0
  63. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/packages_hub.yml +0 -0
  64. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/packages_local.yml +0 -0
  65. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/profiles/profiles_template.yml +0 -0
  66. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/seeds/.gitkeep +0 -0
  67. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/dbt_projects/snowflake/snapshots/.gitkeep +0 -0
  68. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/helper/__init__.py +0 -0
  69. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/helper/core.py +0 -0
  70. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/helper/env_default.py +0 -0
  71. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/helper/log.py +0 -0
  72. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/helper/log_utils.py +0 -0
  73. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/models/avroasset.py +0 -0
  74. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/models/qdc.py +0 -0
  75. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/__init__.py +0 -0
  76. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/bigquery.py +0 -0
  77. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/databricks.py +0 -0
  78. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/lineage.py +0 -0
  79. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/qdc.py +0 -0
  80. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/redshift.py +0 -0
  81. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/snowflake.py +0 -0
  82. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/sqllineage.py +0 -0
  83. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/stats.py +0 -0
  84. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/teradata/lineage.py +0 -0
  85. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/profilers/teradata/stats.py +0 -0
  86. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/redshift.py +0 -0
  87. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/__init__.py +0 -0
  88. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/bigquery.py +0 -0
  89. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/databricks.py +0 -0
  90. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/dbt.py +0 -0
  91. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/qdc.py +0 -0
  92. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/redshift.py +0 -0
  93. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/snowflake.py +0 -0
  94. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/ssm.py +0 -0
  95. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/repository/teradata.py +0 -0
  96. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/snowflake.py +0 -0
  97. {quollio_core-0.6.3 → quollio_core-0.6.5}/quollio_core/teradata.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quollio-core
3
- Version: 0.6.3
3
+ Version: 0.6.5
4
4
  Summary: Quollio Core
5
5
  Author-email: quollio-dev <qt.dev@quollio.com>
6
6
  Maintainer-email: RyoAriyama <ryo.arym@gmail.com>, tharuta <35373297+TakumiHaruta@users.noreply.github.com>
@@ -1,4 +1,4 @@
1
1
  """Quollio Core"""
2
2
 
3
- __version__ = "0.6.3"
3
+ __version__ = "0.6.5"
4
4
  __author__ = "Quollio Technologies, Inc"
@@ -0,0 +1,103 @@
1
+ {%- materialization divided_view, default %}
2
+ {%- set identifier = model['alias'] %}
3
+ {%- set target_relations = [] %}
4
+ {%- set grant_config = config.get('grants') %}
5
+ {%- set max_columns_per_view = config.get('max_columns_per_view', 100) %}
6
+
7
+ {{ run_hooks(pre_hooks, inside_transaction=False) }}
8
+ -- BEGIN happens here:
9
+ {{ run_hooks(pre_hooks, inside_transaction=True) }}
10
+
11
+ -- fetch target_tables
12
+ {%- set query_stats_target_tables -%}
13
+ SELECT
14
+ TABLE_CATALOG
15
+ , TABLE_SCHEMA
16
+ , TABLE_NAME
17
+ , OBJECT_AGG(COLUMN_NAME, OBJECT_CONSTRUCT('IS_CALCULABLE', IS_CALCULABLE, 'CAN_APPROX_COUNT', CAN_APPROX_COUNT))
18
+ FROM
19
+ {{ ref('quollio_stats_profiling_columns') }}
20
+ WHERE NOT startswith(table_name, 'QUOLLIO_')
21
+ GROUP BY
22
+ TABLE_CATALOG
23
+ , TABLE_SCHEMA
24
+ , TABLE_NAME
25
+ {%- endset -%}
26
+ {%- set results = run_query(query_stats_target_tables) -%}
27
+ {%- if execute -%}
28
+ {%- set stats_target_tables = results.rows -%}
29
+ {%- else -%}
30
+ {%- set stats_target_tables = [] -%}
31
+ {%- endif -%}
32
+
33
+ -- skip creating views if the target profiling columns don't exist.
34
+ {%- if stats_target_tables | length == 0 -%}
35
+ {% call statement("main") %}
36
+ {{ log("No records found. Just execute select stmt for skipping call statement.", info=True) }}
37
+ select null
38
+ {% endcall %}
39
+ {%- set full_refresh_mode = (should_full_refresh()) -%}
40
+ {%- set should_revoke = should_revoke(target_relation, full_refresh_mode) %}
41
+ {%- endif -%}
42
+
43
+ -- create view for each table
44
+ {%- for stats_target_table in stats_target_tables -%}
45
+ {%- set columns_json = fromjson(stats_target_table[3]) %}
46
+ {%- set column_list = columns_json.keys() | list %}
47
+ {%- set chunk_count = ((column_list | length) / max_columns_per_view) | round(0, 'ceil') | int %}
48
+
49
+ {%- for chunk_index in range(chunk_count) %}
50
+ {%- set start_idx = chunk_index * max_columns_per_view %}
51
+ {%- set end_idx = start_idx + max_columns_per_view %}
52
+ {%- set chunk_columns = column_list[start_idx:end_idx] %}
53
+
54
+ -- build sql for column value aggregation.
55
+ {%- set sql_for_column_stats %}
56
+ {%- for col_name in chunk_columns -%}
57
+ {%- set attr = columns_json[col_name] %}
58
+ {%- if not loop.first %}UNION{% endif %}
59
+ SELECT
60
+ DISTINCT
61
+ '{{stats_target_table[0]}}' as db_name
62
+ , '{{stats_target_table[1]}}' as schema_name
63
+ , '{{stats_target_table[2]}}' as table_name
64
+ , '{{col_name}}' as column_name
65
+ , {% if attr["IS_CALCULABLE"] == True %}CAST(MAX("{{col_name}}") AS STRING){% else %}NULL{% endif %} AS max_value
66
+ , {% if attr["IS_CALCULABLE"] == True %}CAST(MIN("{{col_name}}") AS STRING){% else %}NULL{% endif %} AS min_value
67
+ , COUNT_IF("{{col_name}}" IS NULL) AS null_count
68
+ , {% if attr["CAN_APPROX_COUNT"] == True %}APPROX_COUNT_DISTINCT("{{col_name}}"){% else %}NULL{% endif %} AS cardinality
69
+ , {% if attr["IS_CALCULABLE"] == True %}AVG("{{col_name}}"){% else %}NULL{% endif %} AS avg_value
70
+ , {% if attr["IS_CALCULABLE"] == True %}MEDIAN("{{col_name}}"){% else %}NULL{% endif %} AS median_value
71
+ , {% if attr["IS_CALCULABLE"] == True %}APPROX_TOP_K("{{col_name}}")[0][0]{% else %}NULL{% endif %} AS mode_value
72
+ , {% if attr["IS_CALCULABLE"] == True %}STDDEV("{{col_name}}"){% else %}NULL{% endif %} AS stddev_value
73
+ FROM "{{stats_target_table[0]}}"."{{stats_target_table[1]}}"."{{stats_target_table[2]}}" {{ var("sample_method") }}
74
+ {% endfor -%}
75
+ {%- endset %}
76
+
77
+ -- create a view with a index as suffix and chunk indicator
78
+ {%- set chunk_suffix = "" if chunk_count == 1 else "_PART" ~ (chunk_index + 1) %}
79
+ {%- set stats_view_identifier = "\"%s_%s_%s_%s%s\"" | format(model['name'], stats_target_table[0], stats_target_table[1], stats_target_table[2], chunk_suffix) | upper %}
80
+ {%- set schema_name = "\"%s\""|format(schema) %}
81
+ {%- set db_name = "\"%s\""|format(database) %}
82
+ {%- set target_relation = api.Relation.create(identifier=stats_view_identifier, schema=schema_name, database=db_name, type='view') %}
83
+
84
+ {{ log("Creating view " ~ stats_view_identifier ~ " with " ~ chunk_columns | length ~ " columns (chunk " ~ (chunk_index + 1) ~ " of " ~ chunk_count ~ ")", info=True) }}
85
+
86
+ {% call statement("main") %}
87
+ {{ get_create_view_as_sql(target_relation, sql_for_column_stats) }}
88
+ {% endcall %}
89
+
90
+ {%- set full_refresh_mode = (should_full_refresh()) -%}
91
+ {%- set should_revoke = should_revoke(target_relation, full_refresh_mode) %}
92
+ {%- do apply_grants(target_relation, grant_config, should_revoke) %}
93
+ {%- set target_relations = target_relations.append(target_relation) %}
94
+ {%- endfor %}
95
+ {%- endfor -%}
96
+
97
+ {{ run_hooks(post_hooks, inside_transaction=True) }}
98
+ -- COMMIT happens here:
99
+ {{ adapter.commit() }}
100
+ {{ run_hooks(post_hooks, inside_transaction=False) }}
101
+
102
+ {{ return({'relations': target_relations}) }}
103
+ {%- endmaterialization -%}
@@ -1,87 +0,0 @@
1
- {%- materialization divided_view, default %}
2
- {%- set identifier = model['alias'] %}
3
- {%- set target_relations = [] %}
4
- {%- set grant_config = config.get('grants') %}
5
-
6
- {{ run_hooks(pre_hooks, inside_transaction=False) }}
7
- -- `BEGIN` happens here:
8
- {{ run_hooks(pre_hooks, inside_transaction=True) }}
9
-
10
- -- fetch target_tables
11
- {%- set query_stats_target_tables -%}
12
- SELECT
13
- TABLE_CATALOG
14
- , TABLE_SCHEMA
15
- , TABLE_NAME
16
- , OBJECT_AGG(COLUMN_NAME, OBJECT_CONSTRUCT('IS_CALCULABLE', IS_CALCULABLE, 'CAN_APPROX_COUNT', CAN_APPROX_COUNT))
17
- FROM
18
- {{ ref('quollio_stats_profiling_columns') }}
19
- WHERE NOT startswith(table_name, 'QUOLLIO_')
20
- GROUP BY
21
- TABLE_CATALOG
22
- , TABLE_SCHEMA
23
- , TABLE_NAME
24
- {%- endset -%}
25
- {%- set results = run_query(query_stats_target_tables) -%}
26
- {%- if execute -%}
27
- {%- set stats_target_tables = results.rows -%}
28
- {%- else -%}
29
- {%- set stats_target_tables = [] -%}
30
- {%- endif -%}
31
-
32
- -- skip creating views if the target profiling columns don't exist.
33
- {%- if stats_target_tables | length == 0 -%}
34
- {% call statement("main") %}
35
- {{ log("No records found. Just execute select stmt for skipping call statement.", info=True) }}
36
- select null
37
- {% endcall %}
38
- {%- set full_refresh_mode = (should_full_refresh()) -%}
39
- {%- set should_revoke = should_revoke(target_relation, full_refresh_mode) %}
40
- {%- endif -%}
41
-
42
- -- create view for each table
43
- {%- for stats_target_table in stats_target_tables -%}
44
- -- build sql for column value aggregation.
45
- {%- set sql_for_column_stats %}
46
- {% set columns_json = fromjson(stats_target_table[3]) %}
47
- {%- for col_name, attr in columns_json.items() -%}
48
- {%- if not loop.first %}UNION{% endif %}
49
- SELECT
50
- DISTINCT
51
- '{{stats_target_table[0]}}' as db_name
52
- , '{{stats_target_table[1]}}' as schema_name
53
- , '{{stats_target_table[2]}}' as table_name
54
- , '{{col_name}}' as column_name
55
- , {% if attr["is_calclable"] == True %}CAST(MAX("{{col_name}}") AS STRING){% else %}NULL{% endif %} AS max_value
56
- , {% if attr["is_calclable"] == True %}CAST(MIN("{{col_name}}") AS STRING){% else %}NULL{% endif %} AS min_value
57
- , COUNT_IF("{{col_name}}" IS NULL) AS null_count
58
- , {% if attr["can_approx_count"] == True %}APPROX_COUNT_DISTINCT("{{col_name}}"){% else %}NULL{% endif %} AS cardinality
59
- , {% if attr["is_calclable"] == True %}AVG("{{col_name}}"){% else %}NULL{% endif %} AS avg_value
60
- , {% if attr["is_calclable"] == True %}MEDIAN("{{col_name}}"){% else %}NULL{% endif %} AS median_value
61
- , {% if attr["is_calclable"] == True %}APPROX_TOP_K("{{col_name}}")[0][0]{% else %}NULL{% endif %} AS mode_value
62
- , {% if attr["is_calclable"] == True %}STDDEV("{{col_name}}"){% else %}NULL{% endif %} AS stddev_value
63
- FROM "{{stats_target_table[0]}}"."{{stats_target_table[1]}}"."{{stats_target_table[2]}}" {{ var("sample_method") }}
64
- {% endfor -%}
65
- {%- endset %}
66
-
67
- -- create a view with a index as suffix
68
- {%- set stats_view_identifier = "\"%s_%s_%s_%s\"" | format(model['name'], stats_target_table[0], stats_target_table[1], stats_target_table[2]) | upper %}
69
- {%- set schema_name = "\"%s\""|format(schema) %}
70
- {%- set db_name = "\"%s\""|format(database) %}
71
- {%- set target_relation = api.Relation.create(identifier=stats_view_identifier, schema=schema_name, database=db_name, type='view') %}
72
- {% call statement("main") %}
73
- {{ get_create_view_as_sql(target_relation, sql_for_column_stats) }}
74
- {% endcall %}
75
- {%- set full_refresh_mode = (should_full_refresh()) -%}
76
- {%- set should_revoke = should_revoke(target_relation, full_refresh_mode) %}
77
- {%- do apply_grants(target_relation, grant_config, should_revoke) %}
78
- {%- set target_relations = target_relations.append(target_relation) %}
79
- {%- endfor -%}
80
-
81
- {{ run_hooks(post_hooks, inside_transaction=True) }}
82
- -- `COMMIT` happens here:
83
- {{ adapter.commit() }}
84
- {{ run_hooks(post_hooks, inside_transaction=False) }}
85
-
86
- {{ return({'relations': target_relations}) }}
87
- {%- endmaterialization -%}
File without changes
File without changes