YAML -> SQL

YAML

    

main:
  from: data
  distinct_on:
  - data.code
  join:
  - query:
      from:        
        values:
        - key: 'us'
          value: 'test1'
        - key: 'fr'
          value: 'France'
      alias: codes
      fields: ["code", "name"]
    alias: countries
    type: left_join
    on:
    - left: countries.code
      operator: "="
      right: data.code
    

SQL

    
SELECT DISTINCT ON ( data.code ) * FROM "data" LEFT JOIN (SELECT * FROM (VALUES ('us', 'test1'), ('fr', 'France')) AS codes(code, name)) countries ON countries.code = data.code