I have a bunch of repeating queries in a Python accessed SQL notebook. I've tested the below
colum_to_agg = f'''data_col_1'''
sql_aggregates_query=f'''
avg({colum_to_agg}) as (concat({colum_to_agg},'_mean')),
max({colum_to_agg}) as (concat({colum_to_agg},'_max')),
'''
print(sql_aggregates_query)
Which returns
avg(data_col_1) as (concat(data_col_1,'_mean')),
max(data_col_1) as (concat(data_col_1,'_max')),
Where i would like
avg(data_col_1) as data_col_1_mean,
max(data_col_1) as data_col_1_max,
I can get the query to run with
colum_to_agg = f'''data_col_1'''
sql_aggregates_query=f'''
avg({colum_to_agg}) as {colum_to_agg}{'_mean'},
max({colum_to_agg}) as {colum_to_agg}{'_max'},
'''
print(sql_aggregates_query)
But am interested to know whether using concat in an alias is possible