1
StaticQuery.queryNA[(String, String)](query)

where query String gets constructed dynamically (programmatically) so number of columns returned from the query isn't known ahead of time.

sample query

select 
  (select field->>'value' from json_array_elements(vcolor.field_ids_json->'fields') as field where (field->>'ddid')::int = 113)
  as mycolor
, 

  (select field->>'value' from json_array_elements(ins.field_ids_json->'fields') as field where (field->>'ddud')::int = 131)
  as insp

above query is built programmatically and may have 10 or 20 such sub-queries each returning one value.

What's the best way to write such a dynamic function queries like this?

Vikas Pandya
  • 1,998
  • 1
  • 15
  • 32

1 Answers1

0

Here is how you can get a Map[String, String] out of a query. ALso works for queryNA.

Slick: query multiple tables/databases with getting column names

Community
  • 1
  • 1
cvogt
  • 11,260
  • 30
  • 46