cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Does Delta Table can be the source of streaming/auto loader?

QPeiran
New Contributor III

Hi,

Since the Auto Loader only accept "append-only" data as the source, I am wondering if the "Delta Table" can also be the source.

Does VACCUM(deleting stale files) or _delta_log(creating nested and different file format than parquet) going to break Auto Loader mechanism? 

3 REPLIES 3

Kaniz
Community Manager
Community Manager

 

Hi @QPeiran, Let’s delve into the details of the Auto Loader and its compatibility with Delta tables.

  1. Auto Loader:

  2. Delta Tables:

    • Delta Tables are a powerful construct in Delta Lake. They provide ACID transactions, efficient indexing, and compatibility with Apache Spark.
    • The _delta_log directory, which contains metadata about changes to the table, is a crucial part of Delta Tables.
    • VACUUM is used to clean up stale files in the _delta_log directory. It reclaims space by removing files that are no longer needed for maintaining the transaction history.
    • VACUUM does not break the Auto Loader mechanism. It only affects the storage layer and does not impact the ability to ingest new data.
  3. Nested and Different File Formats:

    • Delta Tables allow you to store data in a variety of formats, including Parquet.
    • The _delta_log itself is stored in Parquet format.
    • Creating nested structures within Delta Tables (e.g., using STRUCT or MAP data types) does not break the Auto Loader.
    • The Auto Loader processes files based on their arrival in the specified directory, regardless of their internal structure or format.

In summary, Delta Tables can indeed be used as a source for the Auto Loader. Operations like VACUUM and the presence of the _delta_log do not interfere with the Auto Loader’s functionality. Feel free to leverage the power of Delta Lake for efficient data ingestion! 🚀🔗

 

QPeiran
New Contributor III

What I am confused of is on this page https://docs.databricks.com/en/ingestion/auto-loader/options.html#file-format-options 

It indicated a various of formats that can be ingested as the "Source" of Auto Loader, but Delta Lake is not mentioned anywhere, which makes me wondering whether Auto Loader can ingest Delta Lake files in streaming manner.

The Delta Lake VACCUM operation does remove files, so I am not sure if this kind of removal still apply to Auto Loader's "append only" rule or going to break it.

In terms of _delta_log, it is storing check point files in PARQUET but also has a mix of JSON and CRC files. Will this mix of files going to break the Auto Loader?

artsheiko
Valued Contributor III
Valued Contributor III

Hi @QPeiran,

Auto-loader is a feature that allows to integrate files into the Data Platform. Once your data is stored into the Delta Table, you can rely on spark.readStream.table("<my_table_name>") to continuously read from the table.

Take a look at the CDC demo showcasing the integration with Autoloader and applying modifications using Structured Streaming.

Depending on your needs, it's possible that the Materialized views could be useful in your use-case - you can create a bronze layer with autoloader and then add a MV on top of it.