use_subrequest_as_table.sqlx 511 B

1234567891011121314151617181920212223
  1. /* postgres can not */
  2. /* syntax version 1 */
  3. $script = @@
  4. def test(src):
  5. l = []
  6. for i in src:
  7. l.append(str(i.test))
  8. l.append(str(i.test2))
  9. return str(l)
  10. @@;
  11. $test_table_1 =
  12. (
  13. SELECT 1 AS test, "a" AS test2
  14. UNION ALL
  15. SELECT 2 AS test, "b" AS test2
  16. );
  17. $callable = Python::test(Callable<(List<Struct<test:Int32,test2:String?>>) -> String?>, $script);
  18. SELECT
  19. $callable( $test_table_1 ) -- use as const subrequest should contain one column
  20. FROM $test_table_1;