-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* stash * txhash * workflow * prod * drop dev
- Loading branch information
1 parent
b6b9643
commit 28a7897
Showing
13 changed files
with
526 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: dbt_run_overflow_models | ||
run-name: dbt_run_overflow_models | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: | ||
- "main" | ||
|
||
env: | ||
DBT_PROFILES_DIR: ./ | ||
|
||
ACCOUNT: "${{ vars.ACCOUNT }}" | ||
ROLE: "${{ vars.ROLE }}" | ||
USER: "${{ vars.USER }}" | ||
PASSWORD: "${{ secrets.PASSWORD }}" | ||
REGION: "${{ vars.REGION }}" | ||
DATABASE: "${{ vars.DATABASE }}" | ||
WAREHOUSE: "${{ vars.WAREHOUSE }}" | ||
SCHEMA: "${{ vars.SCHEMA }}" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
|
||
jobs: | ||
run_dbt_jobs: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: workflow_prod | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: "pip" | ||
|
||
- name: install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
dbt deps | ||
- name: Run DBT Jobs | ||
run: | | ||
dbt run -m "optimism_models,tag:overflow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{{ config ( | ||
materialized = "view" | ||
) }} | ||
|
||
{% for item in range( | ||
1, | ||
11 | ||
) %} | ||
|
||
SELECT | ||
o.file_name, | ||
f.block_number, | ||
f.index_vals, | ||
f.path, | ||
f.key, | ||
f.value_ | ||
FROM | ||
( | ||
SELECT | ||
file_name, | ||
file_url, | ||
index_cols, | ||
[overflowed_block, overflowed_tx] AS index_vals | ||
FROM | ||
( | ||
SELECT | ||
block_number, | ||
POSITION, | ||
file_name, | ||
file_url, | ||
index_cols, | ||
VALUE [0] AS overflowed_block, | ||
VALUE [1] AS overflowed_tx, | ||
block_number = overflowed_block | ||
AND POSITION = overflowed_tx AS missing | ||
FROM | ||
( | ||
SELECT | ||
block_number, | ||
POSITION, | ||
file_name, | ||
file_url, | ||
index_cols, | ||
utils.udf_detect_overflowed_responses( | ||
file_url, | ||
index_cols | ||
) AS index_vals | ||
FROM | ||
{{ ref("bronze__potential_overflowed_traces") }} | ||
WHERE | ||
row_no = {{ item }} | ||
), | ||
LATERAL FLATTEN ( | ||
input => index_vals | ||
) | ||
) | ||
WHERE | ||
missing = TRUE | ||
) o, | ||
TABLE( | ||
utils.udtf_flatten_overflowed_responses( | ||
o.file_url, | ||
o.index_cols, | ||
[o.index_vals] | ||
) | ||
) f | ||
WHERE | ||
NOT IS_OBJECT( | ||
f.value_ | ||
) | ||
AND NOT IS_ARRAY( | ||
f.value_ | ||
) | ||
AND NOT IS_NULL_VALUE( | ||
f.value_ | ||
) {% if not loop.last %} | ||
UNION ALL | ||
{% endif %} | ||
{% endfor %} |
67 changes: 67 additions & 0 deletions
67
models/bronze/overflow/bronze__potential_overflowed_traces.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{{ config ( | ||
materialized = "view" | ||
) }} | ||
|
||
WITH impacted_blocks AS ( | ||
|
||
SELECT | ||
VALUE :: INT AS block_number | ||
FROM | ||
( | ||
SELECT | ||
blocks_impacted_array | ||
FROM | ||
{{ ref("silver_observability__traces_completeness") }} | ||
ORDER BY | ||
test_timestamp DESC | ||
LIMIT | ||
1 | ||
), LATERAL FLATTEN ( | ||
input => blocks_impacted_array | ||
) | ||
), | ||
all_txs AS ( | ||
SELECT | ||
t.block_number, | ||
t.position, | ||
t.tx_hash | ||
FROM | ||
{{ ref("silver__transactions") }} | ||
t | ||
JOIN impacted_blocks USING (block_number) | ||
), | ||
missing_txs AS ( | ||
SELECT | ||
DISTINCT block_number, | ||
POSITION, | ||
file_name | ||
FROM | ||
all_txs | ||
LEFT JOIN {{ ref("core__fact_traces") }} | ||
tr USING ( | ||
block_number, | ||
tx_hash | ||
) | ||
JOIN {{ ref("streamline__complete_debug_traceBlockByNumber") }} USING (block_number) | ||
WHERE | ||
tr.tx_hash IS NULL | ||
) | ||
SELECT | ||
block_number, | ||
POSITION, | ||
file_name, | ||
build_scoped_file_url( | ||
@streamline.bronze.external_tables, | ||
file_name | ||
) AS file_url, | ||
['block_number', 'array_index'] AS index_cols, | ||
ROW_NUMBER() over ( | ||
ORDER BY | ||
block_number ASC, | ||
POSITION ASC | ||
) AS row_no | ||
FROM | ||
missing_txs | ||
ORDER BY | ||
block_number ASC, | ||
POSITION ASC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.