Hey Patrick! A view would work great for this use case, without external code
A view doesn’t store data, only the query. So if you create a view in a regular MotherDuck database pointing at a table in lake_gold, For example
CREATE VIEW my_db.main.my_view AS SELECT * FROM lake_gold.main.my_table;
every time you query it, it reads the current state of the lake and a full CREATE OR REPLACE TABLE on the lake table shows up right away.
However, MotherDuck doesn’t support triggers or materialized views, the view covers that need, since it’s always current. If the underlying lake table is dropped or renamed, or a column the view references by name is removed, you’d need to recreate the view. Additionally, If you share the database holding the view with other users, they’ll also need access to lake_gold for the view to work.
If you ever need a stored copy instead, you can refresh it on a schedule with CREATE OR REPLACE TABLE ... AS SELECT * FROM lake_gold.... Let me know if this makes sense!