Skip to content

run_sql for each row #328

Answered by lovasoa
guspower asked this question in Q&A
May 22, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

edit

Since SQLPage v0.25, it is possible to call run_sql on each row of a SQL result set, with

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

json_object is called json_build_object in postgres

original answer

Hi !
Thanks for raising this. Calling a sqlpage function iteratively on all request results is currently not possible. I want to implement this in the future, but it's quite a big change, and it will take a little time.

Yet, you have multiple options to get to the result you want:

  1. You can use the embed property of the card component: https://sql.ophir.dev/documentation.sql?component=card#co…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@guspower
Comment options

@lovasoa
Comment options

Answer selected by guspower
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
functions Related to built-in sqlpage functions
2 participants