YAML -> SQL

YAML

    

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

    

SQL

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