Ksql: Python/Go/Node examples

Created on 24 Sep 2017  路  7Comments  路  Source: confluentinc/ksql

After reading the documentation, I still have no idea how I'd make a connection to KSQL from another non-JVM language. Would a PostgreSQL driver for Node work to connect? The top FAQ question speaks to KSQL being useful to non-JVM language, yet there's no indication on how this is possible.

Most helpful comment

I wrote a simple python wrapper of KSQL REST API
https://github.com/bryanyang0528/ksql-python
Any issues or PRs are welcomed.

All 7 comments

@jadbox You can submit your KSQL queries using the KSQL REST API. So as long as you can send HTTP requests from a language you should be able to submit your queries. Please look at the following example where we submit the queries from a webpage: https://github.com/confluentinc/ksql/blob/0.1.x/ksql-rest-app/src/main/resources/io/confluent/ksql/rest/quickstart.html

I wrote a simple python wrapper of KSQL REST API
https://github.com/bryanyang0528/ksql-python
Any issues or PRs are welcomed.

The KSQL REST API is now documented at https://docs.confluent.io/current/ksql/docs/api.html.

if I don't wanna use a wrapper, just the original KSQL REST API, what would be the HTTP address?
Was trying to test the REST API locally, had the ksql running in a k8s in minikube, and exposed the nodeport service with a specified port number.

Tried my IP + port number I specified as the HTTP address, doesn't work.

By default, the KSQL server listens on http://localhost:8088/ for REST API requests.

You can configure the KSQL REST API endpoint via the listeners server configuration setting: https://docs.confluent.io/current/ksql/docs/installation/server-config/index.html#ksql-server-configuration-file

Thanks for the reply. My KSQL was not running locally, but in a local Kubernetes minikube, which complicates things up.

Try setting the listeners value to http://0.0.0.0:8088/. If you do your portmapping in k8s correctly, this should allow you to access the ksql service from outside minikube.

Was this page helpful?
0 / 5 - 0 ratings