kafka-ops / julie

A solution to help you build automation and gitops in your Apache Kafka deployments. The Kafka gitops!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KSqlDB Session Variables support to enable parametric artefacts

nachomdo opened this issue · comments

Is your feature request related to a problem? Please describe.
KSqlDB added support for session variables on version 0.18 to make it easier to parameterise queries. More information about variables interpolation can be found here

Describe the solution you'd like
A potential solution would be to add an entry to the descriptor file to specify those variables as shown below:

projects:
  - name: "foo"
    ksql:
      artefacts:
        vars:
          partitions: 1
          format: JSON
        streams:
          - path: "ksql/riderlocations.sql"
            name: "riderLocations"

Describe alternatives you've considered

Another alternative would be to specify these variables as a CLI argument (e.g. ksql-migrations tool follow this approach using a --define flag). Also, we can define session vars per each artefact, however, this could end up being too verbose and repetitive even though it could be mitigated with YAML references syntax.

 ksql:
      artefacts:
        streams:
          - path: "ksql/riderlocations.sql"
            name: "riderLocations"
            vars:
               partitions: 1
               format: JSON
          - path: "ksql/orders.sql"
            name: "ordersStream"
            vars:
                partitions: 1
                format: JSON