question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KSQL 5.0 Query not working

See original GitHub issue

First 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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kaiwaehnercommented, Oct 15, 2018

Okay, makes sense.

I think we just need some better documentation with an example then.

1reaction
kaiwaehnercommented, Oct 12, 2018

Okay, the following works for me

query = client.query('select * from PAGEVIEWS_ORIGINAL')
for item in query: print(item)

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting KSQL – Part 1: Why Isn't My KSQL Query ...
In this article, we'll see how to troubleshoot some of the common issues that people encounter with KSQL. More advanced topics such as ......
Read more >
Troubleshoot ksqlDB issues
If a ksqlDB query returns no results and the CLI hangs, use Ctrl+C to stop the query and then review the following topics...
Read more >
Confluent Kafka KSQL 5.0.0 Review and How-To : Microshare.io
With our nested JSON message format, the approaches to extracting JSON fields using scalar function is currently not working. We have two work- ......
Read more >
Not getting result from ksql queries - apache kafka
You can't do a SELECT directly against a Kafka topic in KSQL -- the only two statements in KSQL that allow you to...
Read more >
Raw SQL Queries in EF-Core - Learn Entity Framework Core 5
If the LINQ queries generated automatically by the system are not suitable to the application, then the Raw SQL queries can help in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found