1
  1. read from kafka this worked
raw_kafka_test = (spark.readStream
.etc
)
@dlt.table(
    table_properties={"pipelines.reset.allowed":"false"}
)
def raw_kafka():
    return raw_kafka_test
  1. read from delta live table not worked
@dlt.table(
    comment="real schema for Kakfa payload",
    temporary=True
)
def data_kafka():
  return (
    dlt.read_stream("raw_kafka")

  )

what should i do with read from delta live table

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
emperor
  • 11
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 03 '23 at 05:44

1 Answers1

0

You need to put spark.readStream inside the function, not outside of it.


@dlt.table(
    table_properties={"pipelines.reset.allowed":"false"}
)
def raw_kafka():
    raw_kafka_test = (spark.readStream
.etc
)
    return raw_kafka_test

@dlt.table(
    comment="real schema for Kakfa payload",
    temporary=True
)
def data_kafka():
  return dlt.read_stream("raw_kafka")

In general, all operations should be defined inside the functions - outside you need to have only things like constants definitions, etc. See documentation for more details.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132