Dynamic Table Selection Based on Current Month in Dremio

Hi Team,

I have 12 tables in Dremio, each representing data for a specific month. For example:

January → table_01

February → table_02

December → table_12

Now, I would like to create a single view that dynamically selects data from the table corresponding to the current month index (e.g., table_04 for April). The goal is to have a reusable view that always points to the correct table based on the current month, without having to manually change the source table each time.

Is there any way to achieve this kind of dynamic table reference in Dremio?

Thanks in advance!

Hi team,

Can you please give an update on above mentioned issue ?

Thanks in Advance

If your view does a UNION ALL of 12 tables (1 per month) and each sub-query filters by month(current_date) = ordinal, the planner should prune out 11 sub-queries in the reduce expression phase and leave just one remaining sub-query.