This commit is contained in:
austin 2023-03-16 13:46:38 -04:00
parent cceeb81ede
commit cf32544cb1
8 changed files with 9 additions and 117 deletions

View File

@ -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

View File

@ -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 %}

View File

@ -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) %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -1,4 +1,4 @@
livequery:
reference:
target: prod
outputs:
dev: