mirror of
https://github.com/FlipsideCrypto/gnosis-models.git
synced 2026-02-06 13:37:10 +00:00
clean up logs (#149)
This commit is contained in:
parent
5abc7c1462
commit
c9fabd832d
@ -49,4 +49,8 @@ jobs:
|
||||
|
||||
- name: Execute block_reorg macro
|
||||
run: |
|
||||
dbt run-operation fsc_utils.block_reorg --args "{reorg_model_list: '${{ steps.list_models.outputs.model_list }}', hours: '12'}" && awk '/SQL status/ {print; next} /DELETE FROM/{getline; print} /\/\* {/ {print}' logs/dbt.log
|
||||
dbt run-operation fsc_utils.block_reorg --args "{reorg_model_list: '${{ steps.list_models.outputs.model_list }}', hours: '12'}" && awk '/SQL status/ {print; next} /DELETE FROM/{getline; print} /\/\* {/ {print}' logs/dbt.log
|
||||
|
||||
- name: Execute decoded_logs_cleanup macro
|
||||
run: |
|
||||
dbt run-operation decoded_logs_cleanup
|
||||
23
macros/decoded_logs_cleanup.sql
Normal file
23
macros/decoded_logs_cleanup.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{% macro decoded_logs_cleanup() %}
|
||||
{% set sql %}
|
||||
DELETE FROM
|
||||
{{ ref('silver__decoded_logs') }}
|
||||
d
|
||||
WHERE
|
||||
_inserted_timestamp > DATEADD('hour', -48, SYSDATE())
|
||||
AND NOT EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
{{ ref('silver__logs') }}
|
||||
l
|
||||
WHERE
|
||||
d.block_number = l.block_number
|
||||
AND d.tx_hash = l.tx_hash
|
||||
AND d.event_index = l.event_index
|
||||
AND d.contract_address = l.contract_address
|
||||
AND d.topics [0] :: STRING = l.topics [0] :: STRING
|
||||
);
|
||||
{% endset %}
|
||||
{% do run_query(sql) %}
|
||||
{% endmacro %}
|
||||
Loading…
Reference in New Issue
Block a user