Stream 97 blocks assembly (#134)

* added clone purge fix make directive

* fixed json parsing for get blocks history

* added aws_lambda_role envar to undo_clone directive | added database grants to lambda role

* removed debug logs

---------

Co-authored-by: shah <info@shahnewazkhan.ca>
This commit is contained in:
Shah Newaz Khan 2023-07-31 12:54:18 -07:00 committed by GitHub
parent 76d5ef0dd9
commit 4a1596b0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -2,6 +2,7 @@ SHELL := /bin/bash
# set default target
DBT_TARGET ?= sbx
AWS_LAMBDA_ROLE ?= aws_lambda_flow_api_sbx
dbt-console:
docker-compose run dbt_console
@ -19,4 +20,13 @@ udfs:
--vars '{"UPDATE_UDFS_AND_SPS":True}' \
--profile flow \
--target $(DBT_TARGET) \
--profiles-dir ~/.dbt/
--profiles-dir ~/.dbt/
grant-streamline-privileges:
dbt run-operation grant_streamline_privileges \
--profile flow \
--target $(DBT_TARGET) \
--profiles-dir ~/.dbt/ \
--args '{role: $(AWS_LAMBDA_ROLE)}'
undo_clone_purge: sl-flow-api udfs grant-streamline-privileges

View File

@ -94,10 +94,11 @@
{{ result_var }}
{% endmacro %}
-- macro used to select priveleges on all views/tables in a target chema to a role
{% macro grant_select(role) %}
-- macro used to grant streamline priveleges to a role
{% macro grant_streamline_privileges(role) %}
{{ log("Granting privileges to role: " ~ role, info=True) }}
{% set sql %}
grant usage on database {{ target.database }} to role {{ role }};
grant usage on schema {{ target.schema }} to role {{ role }};
grant select on all tables in schema {{ target.schema }} to role {{ role }};
grant select on all views in schema {{ target.schema }} to role {{ role }};

View File

@ -22,7 +22,7 @@ SELECT
PARSE_JSON(
CONCAT(
'{"grpc": "proto3",',
'"method": "get_block_by_height',
'"method": "get_block_by_height",',
'"block_height":"',
block_height :: INTEGER,
'"}'