KSQL 5.0 Query not working
See original GitHub issueFirst of all, great to see the 5.0 migration merged into the project.
I tried the updated project with my KSQL demo. I started Kafka and KSQL via Confluent CLI and your Python app can connect it successfully. “Show Streams” works well. But the simple “select * from X” query does not work yet. It returns <generator object query at 0x10a4ff370>.
`kai.waehner@Kais-MacBook-12:~|⇒ python Python 2.7.14 |Anaconda custom (64-bit)| (default, Oct 5 2017, 02:28:52) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin Type “help”, “copyright”, “credits” or “license” for more information.
import logging from ksql import KSQLAPI logging.basicConfig(level=logging.DEBUG) client = KSQLAPI(‘http://localhost:8088’) DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:8088 DEBUG:urllib3.connectionpool:http://localhost:8088 “GET /info HTTP/1.1” 200 None client.ksql(‘show tables’) DEBUG:root:KSQL generated: show tables DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:8088 DEBUG:urllib3.connectionpool:http://localhost:8088 “POST /ksql HTTP/1.1” 200 None [{u’tables’: [], u’@type’: u’tables’, u’statementText’: u’show tables;‘}] client.ksql(‘show streams’) DEBUG:root:KSQL generated: show streams DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:8088 DEBUG:urllib3.connectionpool:http://localhost:8088 “POST /ksql HTTP/1.1” 200 None [{u’streams’: [{u’topic’: u’pageviews’, u’type’: u’STREAM’, u’name’: u’PAGEVIEWS_ORIGINAL’, u’format’: u’DELIMITED’}], u’@type’: u’streams’, u’statementText’: u’show streams;'}] client.query(‘select * from pageviews_original’) <generator object query at 0x10a4ff370>`
Any ideas?
It is a normal KSQL Stream, nothing special:
`ksql> describe pageviews_original;
Name : PAGEVIEWS_ORIGINAL Field | Type
ROWTIME | BIGINT (system) ROWKEY | VARCHAR(STRING) (system) VIEWTIME | BIGINT USERID | VARCHAR(STRING) PAGEID | VARCHAR(STRING)
For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>; ksql>`
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Okay, makes sense.
I think we just need some better documentation with an example then.
Okay, the following works for me
And please note that I am a total Python newbie 😃 - otherwise I would have realized that
generator object
is a common term in Python. Sounded to me like an exception…But I would still like to see the “print option” so that you can print it with just one single command (makes interactive analysis easier).