bryanyang0528/ksql-python

Add setting of stream properties support

jurieotto opened this issue · 3 comments

For example it is not possible to run the KSQL query:
SELECT * FROM pageviews;
with the properties:
SET 'auto.offset.reset' = 'earliest';

In this example, allowing the configuration of the 'auto.offset.reset' property, allows for queries from the start of the data and not just from the current data position.

The KSQL JSON format does support the setting of the stream properties and can be set as follows:

POST /query HTTP/1.1
Accept: application/vnd.ksql.v1+json
Content-Type: application/vnd.ksql.v1+json

{
  "ksql": "SELECT * FROM pageviews;",
  "streamsProperties": {
    "ksql.streams.auto.offset.reset": "earliest"
  }
}

I propose the following interface for this feature:
client.query("SELECT * FROM pageviews;", streams_properties={'auto.offset.reset': 'earliest'})

I am busy working on this feature, because it is quite useful for me.

I have closed my pull request for this implementation, because I see this pull request also contains an implementation for this feature.

Because #31 is merged, I will close this issue.

Seems like this feature is implemented. But how do you use it?

The following does not work:

client.query("SELECT * FROM pageviews;", streams_properties={'auto.offset.reset': 'earliest'})

Can you please add the right syntax to the readme?