Laure Vancau
09/11/2025, 1:41 PMspark.jars.packages: org.apache.spark:spark-sql-kafka-0-10_2.12:3.2.4,org.apache.spark:spark-token-provider-kafka-0-10_2.12:3.2.4)
From what i have understood, my dataset definition in the catalogue should be something like this:
data:
type: spark.SparkStreamingDataSet
file_format: kafka
load_args:
options:
subscribe: my-topic
kafka.bootstrap.servers: kafka:0000
startingOffsets: earliest
however, I cannot navigate around the error :
DatasetError: Failed while loading data from data set
SparkStreamingDataset(file_format=kafka, filepath=., load_args={'options':
{'kafka.bootstrap.servers': kafka:0000, 'startingOffsets': earliest,
'subscribe': my-topic}}, save_args={}).
schema should be StructType or string
Would you have any example projects or extra docs to point me to ?
Thanks a bunch šJitendra Gundaniya
09/11/2025, 1:53 PMLaure Vancau
09/11/2025, 2:23 PMJitendra Gundaniya
09/11/2025, 2:28 PMLaure Vancau
09/11/2025, 2:35 PMDatasetError: Failed while loading data from data set
SparkStreamingDataset(file_format=kafka, filepath=.,
load_args={'kafka.bootstrap.servers': kafka:0000, 'startingOffsets': earliest,
'subscribe': my-topic}, save_args={}).
requirement failed: Kafka source has a fixed schema and cannot be set with a
custom one
I had understood the schema argument was necessary when tied to the file_format json or csv i.e. spark streaming not coupled to kafka.Laure Vancau
09/11/2025, 2:35 PMJitendra Gundaniya
09/11/2025, 3:04 PMkedro-datasets are you using?Deepyaman Datta
09/11/2025, 4:50 PMin the example project I also see there's an absence of the schema argument
https://github.com/deepyaman/kedro-streaming/blob/develop/conf/base/catalog.ymlFWIW this is a hackathon project from 2021. š It implements it's own dataset that predates whatever is in
kedro-datasets, so the configuration may not line up.
I wasn't very involved in the version that is in kedro-datasets, but it looks like I commented that it was OK to require schema? š
https://github.com/kedro-org/kedro-plugins/pull/198#discussion_r1209233565
I would consider streaming support in Kedro to be rather experimental at best. This doesn't answer your question, but do you know how you want to use streaming with Kedro? As in, are you looking to interactively run something streaming (more like a demo) or deploy some streaming tables?
One other option you could consider is using the Ibis dataset, depending on what you're looking to do, as Ibis also has Spark Streaming backend support. I haven't tried it with Kedro.Laure Vancau
09/15/2025, 12:36 PMkedro-datasets 1.8.0Laure Vancau
09/15/2025, 12:42 PM[project]
requires-python = ">=3.8,<3.9"
name = "XXX"
readme = "README.md"
dynamic = [ "version",]
dependencies = ["kedro-datasets[spark]", "pyspark~=3.2.0", "psycopg2-binary==2.9.9"]
but we now set a version higher or equal to 6.0.0
Edit: we are also going to update to python 3.9 and above to be able to have a more recent version of kedro datasets, else we have to stay below 1.8.0 ...Deepyaman Datta
09/15/2025, 12:56 PMif there are new inputs, run a preprocessing pipeline streaming versionWhat do you mean by this? I would say the main difference with a streaming pipeline is that it's always running. Do you just mean a deployed streaming pipeline, and if you get new events in Kafka it will process them?
Laure Vancau
09/15/2025, 1:00 PMLaure Vancau
09/15/2025, 1:38 PMLaure Vancau
09/15/2025, 1:48 PMdef load(self) -> DataFrame:
"""Loads data from filepath.
If the connector type is kafka then no file_path is required, schema needs to be
seperated from load_args.
Returns:
Data from filepath as pyspark dataframe.
"""
load_path = strip_dbfs_prefix(self._fs_prefix + str(self._filepath))
data_stream_reader = (
get_spark()
.readStream.schema(self._schema)
.format(self._file_format)
.options(**self._load_args)
)
return data_stream_reader.load(load_path)
we think it jsut needs an if/else for filepath kafka or not kafka. For not kafka the readStream should keep the .schema and for kafka it should not have it.
we will open an issue / PR š any recommendation on the kedro processes?
is it correct we should make the PR here: https://github.com/kedro-org/awesome-kedro ?Laure Vancau
09/15/2025, 1:49 PMDeepyaman Datta
09/15/2025, 2:17 PMLaure Vancau
09/16/2025, 8:07 AM