This file contains hidden or 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
def export_deleted_rows(self, bq_client, ghost_table_id, schema_table_id, bt_project, bt_instance, bt_app_profile, bt_table, rowkey_column, change_timestamp_column): | |
ghost_schema = self.get_detailed_schema(bq_client, ghost_table_id) | |
def build_null_fields(schema_fields): | |
null_fields = [] | |
for field in schema_fields: | |
name = field['name'] | |
if name in [rowkey_column, 'is_synced']: | |
continue |
This file contains hidden or 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
func CallWithRetry[T any](cfg RetryConfig[T]) (T, error) { | |
var result T | |
var err error | |
for attempt := 1; attempt <= cfg.MaxAttempts; attempt++ { | |
result, err = cfg.Do() | |
if attempt < cfg.MaxAttempts && cfg.ShouldRetry != nil && cfg.ShouldRetry(result, err) { | |
if cfg.OnRetry != nil { | |
cfg.OnRetry(attempt, result) |
This file contains hidden or 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
SELECT | |
DATE(event_time) AS event_date, | |
MIN(CAST(JSON_EXTRACT_SCALAR(event_misc, "$.nbh") AS BIGNUMERIC)) AS min_nbh | |
FROM | |
noonprd-mp-analytics.noon_analytics_tool.raw_events_v2 | |
WHERE | |
event_date BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH) AND CURRENT_DATE() | |
AND property_code = 'noon' | |
AND JSON_EXTRACT_SCALAR(event_misc, "$.mc") = "noon" | |
AND event_type = 'page_catalog' |