Fast Moving Holistic Aggregates(duckdb.org) |
Fast Moving Holistic Aggregates(duckdb.org) |
The first option is to create a macro: https://duckdb.org/docs/sql/statements/create_macro
The second is Python-specific, but you can have UDF's straight from Python! It's on the roadmap to scale this to the other supported languages. https://github.com/duckdb/duckdb/pull/1569
In general, I also think that SQL is still abstracting a lot of the complexity you would have to handle in an imperative language. These holistic moving averages are actually a great example of why I love SQL! I just learn the WINDOW functions syntax once and it works for many queries.