Initial publish of dbt_f2dq (f2dq) package v0.12.1.
Clean package repo for Gitea installs via packages.yml git URL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
{% macro row_value(agate_row, column) %}
|
||||
{{ return (agate_row[f2dq.name_in_db(column)]) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro agate_to_list(table) %}
|
||||
{% set col_names = table.column_names %}
|
||||
{% set query_result = [] %}
|
||||
{% for row in table.rows %}
|
||||
{% set pairs = [] %}
|
||||
{% for col_name in col_names %}
|
||||
{% set value = row.get(col_name) | string %}
|
||||
{% do pairs.append('"' ~ (col_name | lower) ~ '":' ~ '"' ~ (value | replace('"', '\\\"') | replace('\n', '\\n') ) ~ '"') %}
|
||||
{% endfor %}
|
||||
{% set joined_pairs = '{' ~ (pairs | join(',')) ~ '}' %}
|
||||
{% do query_result.append(joined_pairs) %}
|
||||
{% endfor %}
|
||||
{% set query_result = '[' ~ (query_result | join(',')) ~ ']' %}
|
||||
{{ return (query_result) }}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user