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: 

DLT create_table vs create_streaming_table

ggsmith
New Contributor III

What is the difference between the create_table and create_streaming_table functions in dlt?

For example, this is how I have created a table that streams data from kafka written as json files to a volume.

 

 

@Dlt.table(
    name="raw_orders",
    table_properties={"quality": "bronze", "pipelines.reset.allowed": "false"},
    temporary=False,
)
def create_table():
    query = (
        spark.readStream.format("cloudFiles")
        ...

 

 

 But I see this in the documentation a lot and don't really understand when to use each.

 

 

dlt.create_streaming_table("raw_orders")

 

 

 

1 REPLY 1

filipniziol
New Contributor II

Hi @ggsmith ,

If you check the examples, you will notice that dlt.create_streaming_table is more specialized and you may consider it to be your target.
As per documentation:

filipniziol_1-1726597509582.png

Check this example:
https://www.reddit.com/r/databricks/comments/1b9jg3t/deduping_a_table_created_via_delta_live/

What you can observe:

  • @dlt.table /@dlt.create_table -> it will be used for your source (with readStream is used)
  • dlt.create_streaming_table to define your target and then to run dlt.apply_changes specifying source and target

In general @dlt.table / @dlt.create_table is more robust, whereas dlt.create_streaming_table is a form of syntax sygar designed so it is easier to define streaming targets.

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