|
|
|
|
|
by yomritoyj
1682 days ago
|
|
This what is so great and yet limiting about SQL. Carefully optimized implementations, but only for a fixed set of built-in functions. Are there any frameworks which allow user-defined functions to gain some of these optimization benefits without exposing the full internals of the data-store implementation to them? |
|
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.