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.
Showing results for 
Search instead for 
Did you mean: 

How to write data to Confluent Kafka with SchemaRegistry format on sparkstructured?

New Contributor II

Hi There!
I am to trying write a batch data to kafka topic with schema registry in databricks using pyspark, i serialize the data with pyspark to_avro function and write it to the topic, but the consumers can’t read the schema id. If they do not separate the schema_id first 5 bytes they can read the data as well.
I read the avro schema from .avsc file downloaded in confluent, and it’s version is ok.

This is my script:, schema_str)).alias("value") \
.write \
.format('kafka') \
.option("kafka.bootstrap.servers", confluent_server) \
.option("topic", topico) \
.option("", "SASL_SSL") \
f" required username='{confluent_user}' password='{confluent_pass}';"
) \
.option("kafka.ssl.endpoint.identification.algorithm", "https") \
.option("kafka.sasl.mechanism", "PLAIN") \

return df

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!