lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly

Home Page:https://sql.ophir.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow calling sqlpage functions on all rows returned from a database query

lovasoa opened this issue · comments

Currently sqlpage functions are executed before the query is sent to the database, and their output is sent to the database.
To use a value from the database as input in a sqlpage function, one needs to define a variable:

set $x = (select x from y where id = 123);
select sqlpage.some_function($x);

However, the following is not possible:

select sqlpage.some_function(x) from y;

we should lift this limitation.

see #328

@guspower, @amrutadotorg, this is now fully implemented and works. Finally, starting in 0.25, you can do things like

select 'dynamic' as component, 
    sqlpage.run_sql('display_product.sql', json_object('product_id', product_id)) as properties
from products;

hey this is great, very cool feature thank you @lovasoa