AN-4987/add-so (#159)

* add so

* edits

* edits
This commit is contained in:
drethereum 2024-07-17 14:47:52 -06:00 committed by GitHub
parent 38295f52a8
commit 64ff4a62bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 35 additions and 13 deletions

View File

@ -2,7 +2,7 @@
materialized = "incremental",
unique_key = "contract_address",
merge_exclude_columns = ["inserted_timestamp"],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(contract_address)",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(contract_address,abi_hash,bytecode), SUBSTRING(contract_address,abi_hash,bytecode)",
tags = ['abis']
) }}

View File

@ -5,6 +5,7 @@
cluster_by = "block_timestamp::date",
tags = ['non_realtime'],
merge_exclude_columns = ["inserted_timestamp"],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(hash,parent_hash,receipts_root,sha3_uncles,state_root,transactions_root)",
full_refresh = false
) }}

View File

@ -2,6 +2,7 @@
materialized = 'incremental',
unique_key = 'contract_address',
merge_exclude_columns = ["inserted_timestamp"],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(contract_address, token_symbol, token_name), SUBSTRING(contract_address, token_symbol, token_name)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,7 @@
materialized = "incremental",
unique_key = "created_contract_address",
merge_exclude_columns = ["inserted_timestamp"],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(block_timestamp, tx_hash, created_contract_address, creator_address), SUBSTRING(created_contract_address, creator_address)",
tags = ['non_realtime']
) }}

View File

@ -4,7 +4,7 @@
incremental_strategy = 'delete+insert',
unique_key = "block_number",
cluster_by = "ROUND(block_number, -3)",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(tx_hash)",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(block_hash, tx_hash, from_address, to_address)",
tags = ['non_realtime'],
full_refresh = false
) }}

View File

@ -4,6 +4,7 @@
incremental_strategy = 'delete+insert',
unique_key = "block_number",
cluster_by = ['block_timestamp::DATE', '_inserted_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_function_signature, origin_from_address, origin_to_address, contract_address, from_address, to_address, symbol), SUBSTRING(origin_function_signature, contract_address, from_address, to_address, symbol)",
tags = ['non_realtime','reorg','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform','version'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, bridge_address, sender, receiver, destination_chain_receiver, destination_chain_id, destination_chain, token_address, token_symbol), SUBSTRING(origin_function_signature, bridge_address, sender, receiver, destination_chain_receiver, destination_chain, token_address, token_symbol)",
tags = ['curated','reorg','heal']
) }}

View File

@ -2,7 +2,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform','version'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, contract_address, pool_address, pool_name, tokens, symbols), SUBSTRING(pool_address, pool_name, tokens, symbols)",
tags = ['curated','reorg','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform','version'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_function_signature, origin_from_address, origin_to_address, contract_address, pool_name, event_name, sender, tx_to, token_in, token_out, symbol_in, symbol_out), SUBSTRING(origin_function_signature, pool_name, event_name, sender, tx_to, token_in, token_out, symbol_in, symbol_out)",
tags = ['curated','reorg','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, borrower, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, borrower, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, depositor, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, depositor, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, flashloan_token, flashloan_token_symbol, protocol_market), SUBSTRING(origin_function_signature, event_name, flashloan_token, flashloan_token_symbol, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, liquidator, borrower, collateral_token, collateral_token_symbol, debt_token, debt_token_symbol, protocol_market), SUBSTRING(origin_function_signature, event_name, liquidator, borrower, collateral_token, collateral_token_symbol, debt_token, debt_token_symbol, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, payer, borrower, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, payer, borrower, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -3,7 +3,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = ['block_number','platform'],
cluster_by = ['block_timestamp::DATE'],
cluster_by = ['block_timestamp::DATE','platform'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, depositor, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, depositor, protocol_market)",
tags = ['reorg','curated','heal']
) }}

View File

@ -4,7 +4,7 @@
incremental_strategy = 'merge',
merge_exclude_columns = ["inserted_timestamp"],
cluster_by = 'modified_timestamp::DATE',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address); DELETE FROM {{ this }} WHERE _is_deleted = TRUE;",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address, label_type, label_subtype, address_name, project_name), SUBSTRING(address, label_type, label_subtype, address_name, project_name); DELETE FROM {{ this }} WHERE _is_deleted = TRUE;",
tags = ['non_realtime']
) }}

View File

@ -3,7 +3,7 @@
incremental_strategy = 'delete+insert',
unique_key = 'block_number',
cluster_by = ['block_timestamp::DATE', '_inserted_timestamp::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(contract_address, tx_hash)",
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, contract_address, project_name, from_address, to_address, event_type, token_transfer_type), SUBSTRING(contract_address, project_name, from_address, to_address, event_type, token_transfer_type)",
tags = ['curated','reorg']
) }}

View File

@ -2,6 +2,7 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_native_asset_metadata_id',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, symbol, name),SUBSTRING(asset_id, symbol, name)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_native_prices_id',
cluster_by = ['hour::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, symbol, name),SUBSTRING(asset_id, symbol, name)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,7 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_provider_asset_metadata_id',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_provider_prices_id',
cluster_by = ['recorded_hour::DATE','provider'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id),SUBSTRING(asset_id)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,7 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_token_asset_metadata_id',
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)",
tags = ['non_realtime']
) }}

View File

@ -2,6 +2,8 @@
materialized = 'incremental',
incremental_strategy = 'delete+insert',
unique_key = 'complete_token_prices_id',
cluster_by = ['hour::DATE'],
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)",
tags = ['non_realtime']
) }}