From cf32544cb156b80317bdd8eb5e12bddac1b0b1c9 Mon Sep 17 00:00:00 2001 From: austin Date: Thu, 16 Mar 2023 13:46:38 -0400 Subject: [PATCH] stash --- dbt_project.yml | 4 +- macros/create_sps.sql | 2 +- macros/run_sp_create_prod_clone.sql | 8 +-- macros/streamline/api_integrations.sql | 11 ---- macros/streamline/configs.yaml.sql | 75 -------------------------- macros/streamline/streamline_udfs.sql | 22 -------- models/sources.yml | 2 +- profiles.yml | 2 +- 8 files changed, 9 insertions(+), 117 deletions(-) delete mode 100644 macros/streamline/api_integrations.sql delete mode 100644 macros/streamline/streamline_udfs.sql diff --git a/dbt_project.yml b/dbt_project.yml index 4257307..fb47932 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,12 +1,12 @@ # Name your project! Project names should contain only lowercase characters # and underscores. A good package name should reflect your organization's # name or the intended use of these models -name: "livequery_models" +name: "reference_models" version: "1.0.0" config-version: 2 # This setting configures which "profile" dbt uses for this project. -profile: "livequery" +profile: "reference" # These configurations specify where dbt should look for different types of files. # The `source-paths` config, for example, states that models in this project can be diff --git a/macros/create_sps.sql b/macros/create_sps.sql index 2404546..ea91fdd 100644 --- a/macros/create_sps.sql +++ b/macros/create_sps.sql @@ -1,6 +1,6 @@ {% macro create_sps() %} {% if var("UPDATE_UDFS_AND_SPS") %} - {% if target.database == 'LIVEQUERY' %} + {% if target.database == 'REFERENCE' %} CREATE schema IF NOT EXISTS _internal; {{ sp_create_prod_clone('_internal') }}; {% endif %} diff --git a/macros/run_sp_create_prod_clone.sql b/macros/run_sp_create_prod_clone.sql index f2c23fb..19d9e7e 100644 --- a/macros/run_sp_create_prod_clone.sql +++ b/macros/run_sp_create_prod_clone.sql @@ -1,9 +1,9 @@ {% macro run_sp_create_prod_clone() %} {% set clone_query %} - call livequery._internal.create_prod_clone( - 'livequery', - 'livequery_dev', - 'livequery_dev_owner' + call reference._internal.create_prod_clone( + 'reference', + 'reference_dev', + 'reference_dev_owner' ); {% endset %} {% do run_query(clone_query) %} diff --git a/macros/streamline/api_integrations.sql b/macros/streamline/api_integrations.sql deleted file mode 100644 index f6d2d38..0000000 --- a/macros/streamline/api_integrations.sql +++ /dev/null @@ -1,11 +0,0 @@ -{% macro create_aws_ethereum_api() %} - {% if target.name == "prod" %} - {% set sql %} - CREATE api integration IF NOT EXISTS aws_ethereum_api api_provider = aws_api_gateway api_aws_role_arn = 'arn:aws:iam::661245089684:role/snowflake-api-ethereum' api_allowed_prefixes = ( - 'https://e03pt6v501.execute-api.us-east-1.amazonaws.com/prod/', - 'https://mryeusnrob.execute-api.us-east-1.amazonaws.com/dev/' - ) enabled = TRUE; -{% endset %} - {% do run_query(sql) %} - {% endif %} -{% endmacro %} diff --git a/macros/streamline/configs.yaml.sql b/macros/streamline/configs.yaml.sql index 59d0949..471371e 100644 --- a/macros/streamline/configs.yaml.sql +++ b/macros/streamline/configs.yaml.sql @@ -3,44 +3,6 @@ {# UTILITY SCHEMA #} -- name: _utils.udf_introspect - signature: - - [echo, STRING] - func_type: SECURE EXTERNAL - return_type: TEXT - api_integration: '{{ var("API_INTEGRATION") }}' - sql: introspect - - -- name: _utils.udf_whoami - signature: [] - func_type: SECURE - return_type: TEXT - options: NOT NULL STRICT IMMUTABLE MEMOIZABLE - sql: | - SELECT - COALESCE(SPLIT_PART(GETVARIABLE('QUERY_TAG_SESSION'), ',',2), CURRENT_USER()) - -- name: _utils.udf_register_secret - signature: - - [request_id, STRING] - - [user_id, STRING] - - [key, STRING] - return_type: TEXT - func_type: SECURE EXTERNAL - api_integration: '{{ var("API_INTEGRATION") }}' - options: NOT NULL STRICT - sql: secret/register -- name: utils.udf_register_secret - signature: - - [request_id, STRING] - - [key, STRING] - func_type: SECURE - return_type: TEXT - options: NOT NULL STRICT IMMUTABLE - sql: | - SELECT - _utils.UDF_REGISTER_SECRET(REQUEST_ID, _utils.UDF_WHOAMI(), KEY) - name: utils.udf_hex_to_int signature: @@ -82,42 +44,5 @@ try_hex_decode_string(hex), '[\x00-\x1F\x7F-\x9F\xAD]', '', 1)) -{# - LIVE SCHEMA -#} -- name: _live.udf_api - signature: - - [method, STRING] - - [url, STRING] - - [headers, OBJECT] - - [DATA, OBJECT] - - [user_id, STRING] - - [SECRET, STRING] - return_type: VARIANT - func_type: SECURE EXTERNAL - api_integration: '{{ var("API_INTEGRATION") }}' - options: NOT NULL STRICT - sql: udf_api -- name: live.udf_api - signature: - - [method, STRING] - - [url, STRING] - - [headers, OBJECT] - - [data, OBJECT] - - [secret_name, STRING] - return_type: VARIANT - func_type: SECURE - options: NOT NULL STRICT VOLATILE - sql: | - SELECT - _live.UDF_API( - method, - url, - headers, - data, - _utils.UDF_WHOAMI(), - secret_name - ) - {% endmacro %} diff --git a/macros/streamline/streamline_udfs.sql b/macros/streamline/streamline_udfs.sql deleted file mode 100644 index 4381de6..0000000 --- a/macros/streamline/streamline_udfs.sql +++ /dev/null @@ -1,22 +0,0 @@ -{% macro create_udf_introspect( - drop_ = False - ) %} - {% set name_ = 'silver.udf_introspect' %} - {% set signature = [('json', 'variant')] %} - {% set return_type = 'text' %} - {% set sql_ = construct_api_route("introspect") %} - {% if not drop_ %} - {{ create_sql_function( - name_ = name_, - signature = signature, - return_type = return_type, - sql_ = sql_, - api_integration = var("API_INTEGRATION") - ) }} - {% else %} - {{ drop_function( - name_, - signature = signature, - ) }} - {% endif %} -{% endmacro %} diff --git a/models/sources.yml b/models/sources.yml index 6267a2e..3513a51 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -2,7 +2,7 @@ version: 2 sources: - name: crosschain - database: "{{ 'crosschain' if target.database == 'LIVEQUERY' else 'crosschain_dev' }}" + database: "{{ 'crosschain' if target.database == 'REFERENCE' else 'crosschain_dev' }}" schema: core tables: - name: dim_date_hours \ No newline at end of file diff --git a/profiles.yml b/profiles.yml index 7781bd2..e881083 100644 --- a/profiles.yml +++ b/profiles.yml @@ -1,4 +1,4 @@ -livequery: +reference: target: prod outputs: dev: