ACID stands for atomicity, consistency, isolation, and durability. Together, these properties make database transactions reliable even when errors or system failures occur. section 4.3.1
Relational databases are useful for operational records that require these guarantees. For example, a relational model can store an industrial asset once and link it to multiple work orders and maintenance tasks. section 4.3.1
ACID guarantees can add latency and limit horizontal scalability. Critical operational data may justify that cost, while analytical workloads can sometimes accept eventual consistency for better performance and lower cost. High-volume sensor telemetry is often directed to storage that relaxes some constraints in favor of throughput. section 4.3.1 section 4.6
In a lakehouse, Delta tables add a transaction log and metadata layer over Parquet. This enables record-level inserts, updates, and deletes without manually rewriting entire files, bringing transactional guarantees to object-storage-based analytics. section 4.3.5
Listing 4.5 An example of using Delta tables to provide ACID transactions
import pandas as pd
from deltalake import DeltaTable, write_deltalake
def main():
table_path = "./delta_demo/sensor_data"
df1 = pd.DataFrame( #1
{
"sensor_id": ["temp_001", "temp_002", "humidity_001"],
"location": ["factory", "warehouse", "factory"],
"value": [23.5, 18.2, 65.4],
"timestamp": pd.to_datetime(["2024-01-15 10:30:00"] * 3),
}
)
write_deltalake(table_path, df1) #2
print("Created Delta table with columns:", list(df1.columns))
dt = DeltaTable(table_path)
df_update = pd.DataFrame( #3
{
"sensor_id": ["temp_001"],
"location": ["factory"],
"value": [24.1], # Updated temperature
"timestamp": pd.to_datetime(["2024-01-15 12:00:00"]),
"unit": ["celsius"],
}
)
dt.merge( #4
df_update,
predicate="target.sensor_id = source.sensor_id",
source_alias="source",
target_alias="target",
).when_matched_update_all().when_not_matched_insert_all().execute()
The truncated Python listing creates a local Delta table of sensor readings and begins a merge with an updated reading. section 4.3.5






