514-labs / moose

The developer framework for your data & analytics stack
https://www.moosejs.com
MIT License
20 stars 4 forks source link

Explore pre-populating target table #1109

Closed linear[bot] closed 3 weeks ago

linear[bot] commented 3 weeks ago

Aggregations is essentially a materialized view in clickhouse. Syntax for creating an mv is like this:

CREATE MATERIALIZED VIEW <viewname>
TO <targettablename_version>
AS SELECT ... FROM <sourcetablename_version> ...

When new data lands in source table, the select clause gets executed and results are put in the target table. This trigger will only work on data that lands into source table after the mv is created.

If the user created a source table first, then days/weeks go by and there's data in there, but then they create an mv, existing data in source table will not trigger the mv. It could if the mv has the POPULATE clause, but clickhouse doesn't allow POPULATE & TO clauses to happen in the same query: https://clickhouse.com/docs/en/sql-reference/statements/create/view#materialized-view

This ticket is to investigate whether there's a workaround so user can specific the TO clause while also getting backfilled data into target table.

linear[bot] commented 3 weeks ago

514-909 Explore pre-populating target table