namespace scope macros

This commit is contained in:
shah 2025-04-14 13:12:39 -07:00
parent 37e5f5693c
commit a1987b2e10

View File

@ -36,7 +36,7 @@
func_type = none
) %}
CREATE OR REPLACE {{ func_type }} FUNCTION {{ name_ }}(
{{- compile_signature(signature) }}
{{- livequery_models.compile_signature(signature) }}
)
COPY GRANTS
RETURNS {{ return_type }}
@ -45,7 +45,7 @@
{% endif %}
{%- if api_integration -%}
api_integration = {{ api_integration }}
AS {{ construct_api_route(sql_) ~ ";" }}
AS {{ livequery_models.construct_api_route(sql_) ~ ";" }}
{% else -%}
AS
$$
@ -67,7 +67,7 @@
{% set func_type = config ["func_type"] %}
{% if not drop_ -%}
{{ create_sql_function(
{{ livequery_models.create_sql_function(
name_ = name_,
signature = signature,
return_type = return_type,
@ -113,7 +113,7 @@
CREATE SCHEMA IF NOT EXISTS {{ schema }};
{%- set configs = fromyaml(config_func(blockchain, network)) if network else fromyaml(config_func(schema, blockchain)) -%}
{%- for udf in configs -%}
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
{{- livequery_models.create_or_drop_function_from_config(udf, drop_=drop_) -}}
{%- endfor -%}
{%- endmacro -%}
@ -147,14 +147,14 @@
{%- endfor -%}
{%- endmacro -%}
{% macro ephemeral_deploy_core(config) %}
{% macro livequery_models.ephemeral_deploy_core(config) %}
{#
This macro is used to deploy functions using ephemeral models.
It should only be used within an ephemeral model.
#}
{% if execute and (var("UPDATE_UDFS_AND_SPS") or var("DROP_UDFS_AND_SPS")) and model.unique_id in selected_resources %}
{% set sql %}
{{- crud_udfs(config, this.schema, var("DROP_UDFS_AND_SPS")) -}}
{{- livequery_models.crud_udfs(config, this.schema, var("DROP_UDFS_AND_SPS")) -}}
{%- endset -%}
{%- if var("DROP_UDFS_AND_SPS") -%}
{%- do log("Drop core udfs: " ~ this.database ~ "." ~ this.schema, true) -%}