It would be pretty easy to put a DuckDB data source into this code.
It might be pretty easy to use overloading to get special case implementations that form SQL queries progressively until the results need to be materialized as something like a dataframe for the function code to work on.