prod api integration

This commit is contained in:
Eric Laurello 2024-10-09 17:01:54 -04:00
parent 6aad0ff961
commit 404893008f
6 changed files with 16 additions and 31 deletions

View File

@ -97,15 +97,15 @@ vars:
- INTERNAL_DEV
prod:
API_INTEGRATION: aws_aleo_api
EXTERNAL_FUNCTION_URI: vnmhcb1q2j.execute-api.us-east-1.amazonaws.com/prod/
API_INTEGRATION: aws_aleo_api_prod_v2
EXTERNAL_FUNCTION_URI: onyzmq60n9.execute-api.us-east-1.amazonaws.com/prod/
ROLES:
- AWS_LAMBDA_ALEO_API
- INTERNAL_DEV
- DBT_CLOUD_ALEO
prod-2xl:
API_INTEGRATION: aws_aleo_api
EXTERNAL_FUNCTION_URI: vnmhcb1q2j.execute-api.us-east-1.amazonaws.com/prod/
API_INTEGRATION: aws_aleo_api_prod_v2
EXTERNAL_FUNCTION_URI: onyzmq60n9.execute-api.us-east-1.amazonaws.com/prod/
ROLES:
- AWS_LAMBDA_ALEO_API
- INTERNAL_DEV

View File

@ -1,12 +1,12 @@
{% macro create_sps() %}
{% if target.database == 'aleo' %}
{% if target.database == 'ALEO' %}
CREATE SCHEMA IF NOT EXISTS _internal;
{{ sp_create_prod_clone('_internal') }};
{% endif %}
{% endmacro %}
{% macro enable_search_optimization(schema_name, table_name, condition = '') %}
{% if target.database == 'aleo' %}
{% if target.database == 'ALEO' %}
ALTER TABLE {{ schema_name }}.{{ table_name }} ADD SEARCH OPTIMIZATION {{ condition }}
{% endif %}
{% endmacro %}

View File

@ -1,2 +1,8 @@
{% macro create_udfs() %}
{% if var("UPDATE_UDFS_AND_SPS") %}
{% set sql %}
{{ create_udf_bulk_rest_api_v2() }};
{% endset %}
{% do run_query(sql) %}
{% endif %}
{% endmacro %}

View File

@ -1,21 +0,0 @@
{% macro create_aws_aleo_api() %}
{{ log(
"Creating integration for target:" ~ target
) }}
{% if target.name == "prod" %} -- TODO WHEN PROD DEPLOYS
{% set sql %}
CREATE api integration IF NOT EXISTS aws_aleo_api_prod_v2 api_provider = aws_api_gateway api_aws_role_arn = 'arn:aws:iam::704693948482:role/aleo-api-stg-rolesnowflakeudfsAF733095-JHFljSYqZXeT' api_allowed_prefixes = (
'https://gvmfebiq6g.execute-api.us-east-1.amazonaws.com/stg/'
) enabled = TRUE;
{% endset %}
{% do run_query(sql) %}
{% else %}
{% set sql %}
CREATE api integration IF NOT EXISTS aws_aleo_api_stg_v2 api_provider = aws_api_gateway api_aws_role_arn = 'arn:aws:iam::704693948482:role/aleo-api-stg-rolesnowflakeudfsAF733095-JHFljSYqZXeT' api_allowed_prefixes = (
'https://gvmfebiq6g.execute-api.us-east-1.amazonaws.com/stg/'
) enabled = TRUE;
{% endset %}
{% do run_query(sql) %}
{% endif %}
{% endmacro %}

View File

@ -3,7 +3,7 @@
OR REPLACE EXTERNAL FUNCTION streamline.udf_bulk_rest_api_v2(
json OBJECT
) returns ARRAY api_integration = {% if target.name == "prod" %}
aws_aleo_api_prod_v2 AS 'https://gvmfebiq6g.execute-api.us-east-1.amazonaws.com/stg/udf_bulk_rest_api' -- CHANGE TO PROD URL WHEN DEPLOYED
aws_aleo_api_prod_v2 AS 'https://onyzmq60n9.execute-api.us-east-1.amazonaws.com/prod/udf_bulk_rest_api'
{% else %}
aws_aleo_api_stg_v2 AS 'https://gvmfebiq6g.execute-api.us-east-1.amazonaws.com/stg/udf_bulk_rest_api'
{%- endif %};

View File

@ -4,9 +4,9 @@
func = 'streamline.udf_bulk_rest_api_v2',
target = "{{this.schema}}.{{this.identifier}}",
params ={ "external_table" :"blocks",
"sql_limit" :"3000",
"producer_batch_size" :"100",
"worker_batch_size" :"100",
"sql_limit" :"20000",
"producer_batch_size" :"5000",
"worker_batch_size" :"1000",
"sql_source" :"{{this.identifier}}",
"order_by_column": "block_number",}
)