You are on page 1of 2

asset_table

id, date
1, 01-01-2023
1, 08-02-2023
1, 27-02-2023
2, 01-02-2023
2, 15-02-2023
3, 06-01-2023
3, 07-01-2023
3, 23-01-2023

Query output
ID, Jan, Feb, last_week
1,1,2,1
2,0,2,0
3,3,0,0

select id , count(to_date('date ', 'dd-mm-yyyyy' , 'mm' ,'01') as


Jan ,count(count(to_date('date ', 'dd-mm-yyyyy' , 'mm' ,'02')) as feb , datediff
from asset groupby id

jan feb
1 1 2

we have airflow data pipeline with below tasks


basic_task1 -> basic_task2 -> basic_task3 -> incremental_task1 -> incremental_task2
Optimize this pipeline by introducing "Is_incremental" flag (N - run all the tasks,
Y - run only incremental jobs)

input_list= [1, 2, 3, 4, 5] threshold_val = 3


output_list= [false, false, false, true, true]
output_list = threshold(input_list, threshold_val)

def threshold(input_list ,threshold_val):


for i in input_list:
if i < = threshold_val:
output_list.add('False')
else:
output_list.add('True')

sales
date, amount
01-01-2023, 10000
02-01-2023, 40000
03-01-2023, 25000
date, amount, total sales
01-01-2023,10000, 10000
02-01-2023,40000, 50000
03-01-2023,25000, 75000

select date , amount ,

You might also like