Skip to content

Instantly share code, notes, and snippets.

@meetchandan
Created March 24, 2026 11:55
Show Gist options
  • Select an option

  • Save meetchandan/c249644acae6e9513119e0df3c3a59b2 to your computer and use it in GitHub Desktop.

Select an option

Save meetchandan/c249644acae6e9513119e0df3c3a59b2 to your computer and use it in GitHub Desktop.
[[dags]]
dag_id = 'instock_chatbot'
schedule_interval = '0 */4 * * *'
failure_email_list = ['cbhattad@noon.com']
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'sku_metadata'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "sku_metadata"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
sku,
brand_en,
concat(base_title_en, " ", title_suffix_en) as title,
brand_code,
category,
brand_ar,
concat(base_title_ar, " ", base_title_ar) as title_ar,
FROM noonbitechit.content.product_content
WHERE sku like 'Z%'
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'sku_sales_rank'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "sku_sales_rank"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
sku,
country_code,
units_sold,
sales_rank,
category_rank
FROM noonbitechit.reports.sku_country_sales_rank_l30
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'ds_sku_daily_sales'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "ds_sku_daily_sales"
partitioned = 1
replace = 0
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, wh_code, sku, date_, stock_at_12pm, available_hours, total_hours, availability, units_sold, unit_price, availability_corrected_units_sold, units_liquidated, liquidation_unit_price
FROM noonbinimdwh.chatbot.ds_sku_daily_sales
WHERE date_ >= current_date() - 1
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'daily_sku_fill_rates'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "daily_sku_fill_rates"
partitioned = 1
replace = 0
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, wh_code, sku, ro_nr, replenishment_mode, date_, qty_expected, qty_receieved, fill_rate, remarks, updated_at_gst
FROM noonbinimdwh.chatbot.daily_sku_fill_rates
WHERE date_ >= current_date() - 1
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'ds_sku_drr'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "ds_sku_drr"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, wh_code, sku, l30d_drr
FROM noonbinimdwh.chatbot.ds_sku_drr
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'sku_storage_condition'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "sku_storage_condition"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, sku, volume, wh_storage_condition_code, ds_storage_condition_code
FROM noonbinimdwh.chatbot.sku_storage_condition
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'ds_sku_assortment_base'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "ds_sku_assortment_base"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, wh_code, sku, id_partner, status, never_inbounded_flag, vendor_name
FROM noonbinimdwh.chatbot.ds_sku_assortment_base
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'ats_mega_report'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "ats_mega_report"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, date_, wh_code, sku, ideal_demand, actual_qty_transferred, main_limiting_factor
FROM noonbinimdwh.chatbot.ats_mega_report
WHERE date_ >= current_date() - 1
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'warehouse_base_table'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "warehouse_base_table"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, city, wh_code, partner_wh_code, area_name, wh_type
FROM noonbinimdwh.chatbot.warehouse_base_table
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'warehouse_inventory_req_view'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "warehouse_inventory_req_view"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, sku, id_partner,
warehouse, replen_mode,
tot_stock, delisted_stock,
excess_stock, bau_stock
FROM noonbinimdwh.modelling.warehouse_inventory_req_view
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'ds_inventory_req_view'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "ds_inventory_req_view"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, id_partner, ds_code, wh_code, sku,
replen_mode, vendor_name,
tot_stock, delisted_stock, excess_stock, bau_stock
FROM noonbinimdwh.modelling.ds_inventory_req_view
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'wh_slow_moving_current_stock'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "wh_slow_moving_current_stock"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, warehouse, sku, current_wh_inv
FROM noonbinimdwh.modelling.wh_slow_moving_current_stock
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'oos_daily_attribution'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "oos_daily_attribution"
partitioned = 0
replace = 1
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, city, wh_code, ds_code, ds_name, date_, sku,
vendor_name, vendor_code, replen_all, transfers, is_top, is_top_500,
is_vendor_blocked, l1d_ros, l1d_grn, l7d_ros, l7d_grn, l30d_ros, l30d_grn,
l60d_ros, l60d_grn, storage_condition, avail_hours, total_hours,
is_delivery_delay_ats, is_putaway_delay, is_missing_issue, is_non_live_movement, is_liquidation_issue,
is_promo_issue, under_forecast_issue, no_ats_wishlist_created, wishlist_issue,
ats_created_but_transfer_qty_zero, no_demand_in_ats_for_low_drr, no_demand_in_ats_for_high_drr,
sales_spike_l1d_for_low_drr, vms_missing, wh_ops_capacity, truck_capacity, ds_storage_condition,
no_qty_received_l60d, wh_fill_rate_with_no_open_po_blocked, ro_nr_agg_wh_fill_rate_with_no_open_po_blocked_fill_rate,
ro_nr_agg_wh_fill_rate_with_no_open_po_blocked_others, wh_fill_rate_with_open_po_scheduled_blocked,
ro_nr_agg_wh_fill_rate_with_open_po_scheduled_blocked_fill_rate, ro_nr_agg_wh_fill_rate_with_open_po_scheduled_blocked_others,
wh_fill_rate_with_open_po_not_scheduled_blocked, ro_nr_agg_wh_fill_rate_with_open_po_not_scheduled_blocked_fill_rate,
ro_nr_agg_wh_fill_rate_with_open_po_not_scheduled_blocked_others, wh_fill_rate_with_no_open_po_not_blocked, ro_nr_agg_wh_fill_rate_with_no_open_po_not_blocked_fill_rate, ro_nr_agg_wh_fill_rate_with_no_open_po_not_blocked_others, wh_fill_rate_with_open_po_scheduled_not_blocked, ro_nr_agg_wh_fill_rate_with_open_po_scheduled_not_blocked_fill_rate, ro_nr_agg_wh_fill_rate_with_open_po_scheduled_not_blocked_others, wh_fill_rate_with_open_po_not_scheduled_not_blocked, ro_nr_agg_wh_fill_rate_with_open_po_not_scheduled_not_blocked_fill_rate, ro_nr_agg_wh_fill_rate_with_open_po_not_scheduled_not_blocked_others, wh_fill_rate_with_delivery_delay, ro_nr_agg_wh_fill_rate_with_delivery_delay_fill_rate, ro_nr_agg_wh_fill_rate_with_delivery_delay_others, wh_fill_rate_with_late_and_pending_delivery, ro_nr_agg_wh_fill_rate_with_late_and_pending_delivery, ro_nr_agg_wh_fill_rate_with_late_and_pending_delivery_others, wh_fill_rate_with_putaway_pending, ro_nr_agg_wh_fill_rate_with_putaway_pending_fill_rate, ro_nr_agg_wh_fill_rate_with_putaway_pending_others, wh_fill_rate_with_putaway_delay, ro_nr_agg_wh_fill_rate_with_putaway_delay_fill_rate, ro_nr_agg_wh_fill_rate_with_putaway_delay_others, wh_under_order_with_no_open_po_blocked, ro_nr_agg_wh_under_order_with_no_open_po_blocked_fill_rate, ro_nr_agg_wh_under_order_with_no_open_po_blocked_others, wh_under_order_with_no_open_po_not_blocked, ro_nr_agg_wh_under_order_with_no_open_po_not_blocked_fill_rate, ro_nr_agg_wh_under_order_with_no_open_po_not_blocked_others, open_po_scheduled_blocked, ro_nr_agg_open_po_scheduled_blocked_fill_rate, ro_nr_agg_open_po_scheduled_blocked_others, open_po_scheduled_not_blocked, ro_nr_agg_wh_open_po_scheduled_not_blocked_fill_rate, ro_nr_agg_wh_open_po_scheduled_not_blocked_others, open_po_not_scheduled_blocked, ro_nr_agg_open_po_not_scheduled_blocked_fill_rate, ro_nr_agg_open_not_po_scheduled_blocked_others, open_po_not_scheduled_not_blocked, ro_nr_agg_wh_open_po_not_scheduled_not_blocked_fill_rate, ro_nr_agg_wh_open_po_not_scheduled_not_blocked_others, wh_delivery_delay, ro_nr_agg_wh_delivery_delay_fill_rate, ro_nr_agg_wh_delivery_delay_others, wh_late_and_pending_delivery, ro_nr_agg_wh_late_and_pending_delivery_fill_rate, ro_nr_agg_wh_late_and_pending_delivery_others, wh_putaway_pending,
ro_nr_agg_wh_putaway_pending_fill_rate, ro_nr_agg_wh_putaway_pending_others,
wh_putaway_delay, ro_nr_agg_wh_putaway_delay_fill_rate, ro_nr_agg_wh_putaway_delay_others,
is_delivery_delay_dts, dts_putaway_pending_at_ds, ds_dts_fill_rate_issue, no_active_po_dts,
previous_day_issue, unidentified, updated_at, run_date, total_oos_reasons
FROM noonbinimdwh.modelling.oos_daily_attribution
WHERE run_date >= current_date() - 1
'''
[[custom-bqtoch]]
dag_id = 'instock_chatbot'
task_id = 'fnv_availability_attribution'
ch_cluster = "mxtech"
ch_db = "instock"
ch_table = "fnv_availability_attribution"
partitioned = 1
replace = 0
ch_settings = { max_execution_time = 3000 }
query = '''
SELECT
country_code, city, wh_type, wh_code, partner_wh_code, wh_name, sku,
date_, dow, hour_, stock_net, fps,
cluster_fps, opening_doc, threshold_doc, min_cut_doc, units_sold, units_liq,
dist, drr, po_qty, ro_qty, grn_qty, tot_min_qty, min_demand, ideal_demand,
requested_qty, start_hour, end_hour, received_qty, putaway_qty, cum_dist, cum_sales,
d_sales, d_dist, rr_sales, exp_sales, liq_hour, has_liq_sale, delta, fr, is_ordering_issue,
is_0_ordering, is_fr_issue, is_0_fr, over_stocking_truncation, is_missing_issue, is_late_inward, is_late_putaway,
is_nonlive, pre_is_sales_issue, is_underforecast, is_liquidation_issue, is_sales_issue, unidentified, updated_at
FROM noonbinimdwh.modelling.fnv_availability_attribution
WHERE date_ >= current_date() - 1
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment