cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use SQL Streaming tables

mmenjivar
New Contributor II

We have been testing the usage of Streaming Tables in our pipelines with different results depending on the streaming source

  • For Streaming Tables reading from read_files everything works as expected
  • For Streaming Tables reading from read_kafka we have some contradictory results when executing in a SQL Warehouse:
    • It works when selecting from read_kafka as in the next block:
SELECT
*
FROM read_kafka(bootstrapServers => 'server',
subscribe => 'topic',
startingOffsets => 'earliest',
`kafka.sasl.mechanism` => 'SCRAM-SHA-512',
`kafka.security.protocol` => 'SASL_PLAINTEXT',
`kafka.sasl.jaas.config` => "kafkashaded.org.apache.kafka.common.security.scram.ScramLoginModule required username='user' password = 'pass';",
failOnDataLoss => 'false'
) limit 10;
    • It doesn't work when I try to create a streaming table using the same query running the script on the same SQL Warehouse:
       
      CREATE OR REFRESH STREAMING TABLE u_marlonmenjivar.test as
      SELECT
      *
      FROM stream read_kafka(bootstrapServers => 'server',
      subscribe => 'topic',
      startingOffsets => 'earliest',
      `kafka.sasl.mechanism` => 'SCRAM-SHA-512',
      `kafka.security.protocol` => 'SASL_PLAINTEXT',
      `kafka.sasl.jaas.config` => "kafkashaded.org.apache.kafka.common.security.scram.ScramLoginModule required username='user' password = 'pass';",
      failOnDataLoss => 'false'
      ) limit 10;
The error that returns is: terminated with exception: kafkashaded.org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: describeTopics This error is the same for classic, pro and serverless SQL endpoints.

When executed from a notebook it fails with Multipart table names is not supported and when I execute it without schema doesn't fail but it says

To populate your table you must either:
  • Run an existing pipeline using the Delta Live Tables menu
  • Create a new pipeline

According to documentation, the DLT pipeline should be created automatically, any clue on what I'm doing wrong?

1 REPLY 1

SathyaSDE
New Contributor III

Hi - Pls note:

1) Structure streaming & Delta live table are two different options and have different syntax's.

2) You cannot execute DLT code on notebook directly. It can be run as job.

Pls refer below

https://docs.databricks.com/en/delta-live-tables/sql-ref.html

https://www.databricks.com/blog/2022/08/09/low-latency-streaming-data-pipelines-with-delta-live-tabl...

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group