Sub topic 2
Delta tables: the source of shared data
This chapter assumes you know what tables, schemas and SQL are, and that you have used pandas or Spark DataFrames. It also assumes you have a general idea of cloud object storage such as S3, ADLS or GCS. Delta Sharing serves data from Delta tables, so you need a working model of what a Delta table is before you look at the protocol itself.
What a Delta table is
A Delta table is a directory in object storage that holds two things:
- Parquet data files, which store the rows in columnar form.
- A transaction log in a
_delta_logsubdirectory, which records every change made to the table.
The log is the source of truth. A data file that sits in the directory but is not referenced by the log is not part of the table. Readers never list the directory to find the data. They read the log.
my_table/
_delta_log/
00000000000000000000.json
00000000000000000001.json
00000000000000000010.checkpoint.parquet
part-00000-a1b2.snappy.parquet
part-00001-c3d4.snappy.parquetThe transaction log and versions
Each write to the table (an insert, update, delete or merge) is a commit. A commit adds one numbered JSON file to _delta_log. The number is the table version. The first commit is version 0, the next is version 1, and so on.
A commit lists actions. The most important are add, which makes a Parquet file part of the table, and remove, which takes a file out of it. An update does not edit a file in place. It writes new files, then commits an add for them and a remove for the files they replace.
To find the current state of the table, a reader replays the log from the start, or from the latest checkpoint, and ends up with the set of files that are still active. Every few commits Delta writes a checkpoint, a Parquet file that summarises the state so far, so readers do not replay a long history.
Why this design suits sharing
Three properties of Delta tables matter for Delta Sharing.
- Snapshot isolation. A reader that fixes a version sees a consistent set of files, even while writers commit new versions. A recipient never sees half of an update.
- Files are immutable. Because Parquet files are never changed after they are written, a provider can hand out a link to a file and the content behind that link stays the same. This is what makes pre-signed URLs workable, which a later chapter covers.
- Metadata is in the log. The log holds the schema, the partition columns, and per-file statistics such as minimum and maximum values. A sharing server can answer "which files do I need for this query?" from the log alone, without opening the data files.
Time travel and change data
Because old versions stay in the log until they are cleaned up, you can read a table as of an earlier version or timestamp. In Spark SQL:
SELECT * FROM main.sales.orders VERSION AS OF 3;
SELECT * FROM main.sales.orders TIMESTAMP AS OF '2026-01-01';Delta can also record row-level changes in a change data feed, if the table property is turned on. Later chapters show how a recipient can read versions and changes through Delta Sharing, but only if the provider has kept that history and enabled the feed.
ALTER TABLE main.sales.orders
SET TBLPROPERTIES (delta.enableChangeDataFeed = true);Common errors
- Assuming deleted data is gone at once.
DELETEwrites aremoveaction. The Parquet file stays in storage untilVACUUMremoves it. Time travel and shared reads of old versions break onceVACUUMdeletes those files. - Sharing a path that is not a Delta table. A directory of plain Parquet files has no
_delta_log, so it cannot be shared through Delta Sharing. - Expecting history to be available. Version and change reads depend on log retention and file retention. If the provider has cleaned up old versions, a recipient cannot read them.
- Copying only the data files. Copying the Parquet files without the log gives you files with no table state. You cannot tell which are active.
What comes next
With the log, versions and immutable files in mind, the next chapter defines Delta Sharing itself. It is a protocol that exposes these files and their metadata to outside readers over HTTPS.
Exercise
A provider updates 100 rows in a Delta table. Which actions does the commit contain, and why can a recipient reading an earlier version still get a consistent result?
Show answer
The commit contains add actions for the new Parquet files holding the changed rows and remove actions for the files they replace. The old files are not modified. Because files are immutable and the earlier version's log entries still list them, a reader pinned to that version sees the same files as before, as long as VACUUM has not deleted them.
Exercise
A recipient asks for table version 5, but the request fails. Name two provider-side causes related to what this chapter described.
Show answer
The history may have been cleaned up, so log entries for version 5 are no longer retained. Or VACUUM may have deleted the data files that version 5 referenced. A third possibility is that the table never reached version 5.