# Ksql stream from a Kafka topic

**URL:** <https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143>\
**Category:** ksqlDB\
**Created:** [11 February 2022 12:25 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143 "2022-02-11T12:25:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiuseppeR](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@GiuseppeR](https://forum.confluent.io/u/GiuseppeR)\
**Post date:** [11 February 2022 12:25 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143/1 "2022-02-11T12:25:48Z")

</div>

Hi guys,

I’m using Confluent Platform 7.0.1. I need some hint to process in KSQLDB a data stream from a Kafka topic. I have an application which sends data to a Kafka topic named MyData. I need to intercept the variation of the value of a variable (lat) and write this result on another Kafka topic.  
I created the topic and I defined a valid JSON schema.  
In the KSQLDB editor I create a stream data table:

`CREATE TABLE MyData_stream (id VARCHAR PRIMARY KEY) WITH (kafka_topic='MyData', value_format='JSON');`

when I try to print topics with

`SHOW TOPIC`

it works…If I try to print data from my topic in the KSQLDB editor with:

`PRINT 'MyData' FROM BEGINNING;`

it doesn’t show anything (no data, no message).  
The second step is to create a raw data stream:

`CREATE STREAM MyData_raw (id INT KEY, simulation_id INT, timestamp BIGINT, lat DOUBLE, long DOUBLE,.....) WITH (KAFKA_TOPIC='MyData', KEY_FORMAT='KAFKA', VALUE_FORMAT='JSON');`

but when I try the query:

`SELECT * FROM MyData_raw EMIT CHANGES;`

I have any result.  
So any suggestion? There some error?  
Thanks for your support.

---

<div class="post-metadata">

**Author:** ![vnadkarni](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/vnadkarni/32/1839_2.png) [@vnadkarni](https://forum.confluent.io/u/vnadkarni)\
**Post date:** [15 February 2022 10:35 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143/2 "2022-02-15T10:35:32Z")

</div>

> [@GiuseppeR](#):
>
> I have any result.  
> So any suggestion? There some error?

Hi @GiuseppeR . What result/error do you get?

---

<div class="post-metadata">

**Author:** ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)\
**Post date:** [15 February 2022 17:08 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143/3 "2022-02-15T17:08:32Z")

</div>

> [@GiuseppeR](#):
>
> but when I try the query:
> 
> `SELECT * FROM MyData_raw EMIT CHANGES;`
> 
> I have any result.

Did you set `auto.offset.reset` to `"earliest"` before submitting the query?

---

<div class="post-metadata">

**Author:** ![GiuseppeR](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@GiuseppeR](https://forum.confluent.io/u/GiuseppeR)\
**Post date:** [21 February 2022 16:58 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143/4 "2022-02-21T16:58:42Z")

</div>

Hi guys,

thank you for your replies.  
With my server admin we have established KSQLdb doesn’t work correctly so the stream is not fed from the Kafka topic.  
The task described it is not in KSQLdb…so I wrote a python consumer and It works pretty good.  
Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [13 March 2022 12:26 UTC](https://forum.confluent.io/t/ksql-stream-from-a-kafka-topic/4143/5 "2022-03-13T12:26:17Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
