# Lenses SQL

**URL:** https://ask.lenses.io/c/lenses-sql/7.md

[Latest](https://ask.lenses.io/latest.md) · [Categories](https://ask.lenses.io/categories.md) · [Tags](https://ask.lenses.io/tags.md)

---

## [About the Lenses SQL category](https://ask.lenses.io/t/about-the-lenses-sql-category/17)

<div class="topic-metadata">

**Author:** [@guillaume.ayme](https://ask.lenses.io/u/guillaume.ayme)\
**Replies:** 0

</div>

For all questions and answers related to the Lenses SQL engine - for data observability & for data processing (SQL processors)

---

## [SQL Processor - "SQL Invalid" error when using FORMAT\_DATE(\_meta.timestamp)](https://ask.lenses.io/t/sql-processor-sql-invalid-error-when-using-format-date-meta-timestamp/362)

<div class="topic-metadata">

**Author:** [@wkolbenschlag](https://ask.lenses.io/u/wkolbenschlag)\
**Replies:** 8\
**Last updated:** [July 6, 2026, 7:48pm UTC](https://ask.lenses.io/t/sql-processor-sql-invalid-error-when-using-format-date-meta-timestamp/362 "2026-07-06T19:48:21Z")

</div>

Getting errors while attempting to create an SQL Processor in Lenses: SQL Processor statement: INSERT INTO my\_topic STORE VALUE AS AVRO SELECT STREAM field\_a as \_key, field\_b, FORMAT\_DATE(\_meta.timestamp,…

---

## [Example SQL Snapshot command to create Kafka topic with sales orders JSON events](https://ask.lenses.io/t/example-sql-snapshot-command-to-create-kafka-topic-with-sales-orders-json-events/446)

<div class="topic-metadata">

**Author:** [@james1985](https://ask.lenses.io/u/james1985)\
**Replies:** 1\
**Last updated:** [October 20, 2025, 11:42am UTC](https://ask.lenses.io/t/example-sql-snapshot-command-to-create-kafka-topic-with-sales-orders-json-events/446 "2025-10-20T11:42:01Z")

</div>

Here’s an SQL Snapshot example of creating Sales Order JSON topic and schema in Lenses: CREATE TABLE VBAK\_VBAP\_JSON ( \_key STRING , OrderID STRING , OrderDate STRING , Customer.CustomerID STRING …

---

## [How to Handle Complex JSON Structures in Lenses SQL Queries](https://ask.lenses.io/t/how-to-handle-complex-json-structures-in-lenses-sql-queries/423)

<div class="topic-metadata">

**Author:** [@lawotid](https://ask.lenses.io/u/lawotid)\
**Replies:** 1\
**Last updated:** [August 30, 2025, 6:53pm UTC](https://ask.lenses.io/t/how-to-handle-complex-json-structures-in-lenses-sql-queries/423 "2025-08-30T18:53:23Z")

</div>

Hello I have been working with Kafka topics that contain deeply nested JSON structures, and while Lenses SQL has been great for querying; I am running into challenges when trying to extract and flatten specific fields f…

---

## [Why can't I use the FIRST and LAST SQL commands in SQL Processor?](https://ask.lenses.io/t/why-cant-i-use-the-first-and-last-sql-commands-in-sql-processor/400)

<div class="topic-metadata">

**Author:** [@kafkaesque](https://ask.lenses.io/u/kafkaesque)\
**Replies:** 2\
**Last updated:** [July 23, 2025, 3:53pm UTC](https://ask.lenses.io/t/why-cant-i-use-the-first-and-last-sql-commands-in-sql-processor/400 "2025-07-23T15:53:16Z")

</div>

I often use SQL FIRST and LAST command in SQL Studio, but I can’t use them in SQL Processor? Why not??

---

## [Access to primitive value from streaming SQL](https://ask.lenses.io/t/access-to-primitive-value-from-streaming-sql/254)

<div class="topic-metadata">

**Author:** [@tomlloydcf](https://ask.lenses.io/u/tomlloydcf)\
**Replies:** 2\
**Last updated:** [June 19, 2024, 8:33am UTC](https://ask.lenses.io/t/access-to-primitive-value-from-streaming-sql/254 "2024-06-19T08:33:09Z")

</div>

I have a topic which has a value type of String which I am trying to use in a Lenses SQL processor, but I don’t seem to have access to the \_value property like I do in SQL studio. Is the value available by some other mea…

---

## [Possibility to change image for init-lenses-sql-runner](https://ask.lenses.io/t/possibility-to-change-image-for-init-lenses-sql-runner/213)

<div class="topic-metadata">

**Author:** [@Edward\_k](https://ask.lenses.io/u/Edward_k)\
**Replies:** 1\
**Last updated:** [April 17, 2024, 12:25pm UTC](https://ask.lenses.io/t/possibility-to-change-image-for-init-lenses-sql-runner/213 "2024-04-17T12:25:35Z")

</div>

I managed to update the image for lenses-sql-runner, but I couldn’t do the same for init-lenses-sql-runner, which continues to start from lensesio/lenses-cli:5.4. How can I change the image for init-lenses-sql-runner?

---

## [SQL WHERE clause on arrays](https://ask.lenses.io/t/sql-where-clause-on-arrays/198)

<div class="topic-metadata">

**Author:** [@Simon\_Duchene\_lenses](https://ask.lenses.io/u/Simon_Duchene_lenses)\
**Replies:** 1\
**Last updated:** [March 14, 2024, 3:12pm UTC](https://ask.lenses.io/t/sql-where-clause-on-arrays/198 "2024-03-14T15:12:38Z")

</div>

Hi There, i’m copy/pasting a question from Anand on our Community slack that is valuable for others : I have a challenge to run SQL query with “Where” clause. The Kafka topic is a list of arrays. { "value": \[ { …

---

## [“max size reached” message in Lenses SQL Studio](https://ask.lenses.io/t/max-size-reached-message-in-lenses-sql-studio/148)

<div class="topic-metadata">

**Author:** [@ejhon\_s](https://ask.lenses.io/u/ejhon_s)\
**Replies:** 1\
**Last updated:** [December 20, 2023, 1:48am UTC](https://ask.lenses.io/t/max-size-reached-message-in-lenses-sql-studio/148 "2023-12-20T01:48:10Z")

</div>

Using the SQL Studio, my query is displaying the following message: “Query is finished, max size reached (27 records in 21.37 seconds)” Here is my query: select \* from user-events-apps where \_meta.timestamp \> now()-'…

---

## [Windowing Joins with Lenses SQL Processors](https://ask.lenses.io/t/windowing-joins-with-lenses-sql-processors/95)

<div class="topic-metadata">

**Author:** [@wkolbenschlag](https://ask.lenses.io/u/wkolbenschlag)\
**Replies:** 1\
**Last updated:** [July 26, 2023, 2:56pm UTC](https://ask.lenses.io/t/windowing-joins-with-lenses-sql-processors/95 "2023-07-26T14:56:29Z")

</div>

I have use case where a single processor monitors 2 two separate topics, combines the results into one single output topic. Both source topics having the same key field. If both source topics receive data within a wind…

---

## [User friendly names for the custom Deserializer](https://ask.lenses.io/t/user-friendly-names-for-the-custom-deserializer/77)

<div class="topic-metadata">

**Author:** [@rahul.ks](https://ask.lenses.io/u/rahul.ks)\
**Replies:** 1\
**Last updated:** [June 12, 2023, 10:00am UTC](https://ask.lenses.io/t/user-friendly-names-for-the-custom-deserializer/77 "2023-06-12T10:00:42Z")

</div>

I have written a custom deserialier by implementing com.landoop.lenses.lsql.serde.Serde interface. When this Deserializer is deployed, I go to explore–\> topic–\>Action–\>Schema&metadata–\> change types. I can see its class…

---

## [Populate a sample event with an array into a Kafka topic](https://ask.lenses.io/t/populate-a-sample-event-with-an-array-into-a-kafka-topic/67)

<div class="topic-metadata">

**Author:** [@wkolbenschlag](https://ask.lenses.io/u/wkolbenschlag)\
**Replies:** 1\
**Last updated:** [May 23, 2023, 2:45pm UTC](https://ask.lenses.io/t/populate-a-sample-event-with-an-array-into-a-kafka-topic/67 "2023-05-23T14:45:05Z")

</div>

Are there any examples or tutorials on having a streaming processor create a populate a topic containing an array?

---

## [Duplicate events outputted in Lenses SQL Processor](https://ask.lenses.io/t/duplicate-events-outputted-in-lenses-sql-processor/65)

<div class="topic-metadata">

**Author:** [@wkolbenschlag](https://ask.lenses.io/u/wkolbenschlag)\
**Replies:** 4\
**Last updated:** [May 12, 2023, 4:17pm UTC](https://ask.lenses.io/t/duplicate-events-outputted-in-lenses-sql-processor/65 "2023-05-12T16:17:17Z")

</div>

I’m having an issue where one of my sql processors ‘seems’ to be reprocessing or re-sending events to one of my topics approximately once every two minutes or so. Duplicate events are identical, including timestamp. All…
