Hey Team,
I’m not clear on the ‘as’ parameter of the join.left
function in FLUX, I’m trying to gain a level of clarity on the flux syntax that is similar to SQL. For instance:
Query 1:select a*, b* from A left join B on A.id = B.id
Query 1 Purpose: Join table A with table B using the id column in table A and the id column in table B. Then select all columns from table A and all columns from Table B.
Query 2: select A.var1, A.var2, A.var3, B.var1, B.var2, B.var3 from a left join b on A.id = B.id
Query 2 Purpose: Join table A with table B using the id column in table A and the id column in table B. Then select columns var1, var2 and v3 from table A and columns var1, var2 and v3 from table B.
My attempt to translate this into FLUX:
Query 1 flux version:
join.left(
left: A,
right: B,
on: (l, r) => l.id == r.id,
as: (l, r) => ({???}),)
Query 2 flux version:
join.left(
left: A,
right: B,
on: (l, r) => l.id == r.id,
as: (l, r) => ({
user_entry_col_name_1: l.col1,
user_entry_col_name_2: l.col2,
user_entry_col_name_3: l.col3,
user_entry_col_name_4: r.col1,
user_entry_col_name_5: r.col2,
user_entry_col_name_6: r.col3}),
)
Could you please advise on the flux equivalent on Query 1 and whether the Query 2 flux version template is correct?