Principle:Eventual Inc Daft Temp Table Registration
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, Session_Management |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Technique for registering ephemeral named tables scoped to a session's lifetime.
Description
Temporary table registration creates named table references from DataFrames or schemas that exist only for the session's duration. This enables SQL queries against in-memory DataFrames without persisting data to storage. Temp tables use a replace=True semantic, meaning re-registering with the same name overwrites the previous table. The source can be either a Schema (defining structure only) or a DataFrame (providing both structure and data).
Usage
Use temporary table registration when you need to reference a DataFrame by name in SQL queries within the current session. Common scenarios include ad-hoc SQL analysis on in-memory data, joining multiple DataFrames via SQL, and testing SQL queries against sample data.
Theoretical Basis
Session-scoped table namespace with automatic cleanup on session termination:
Session S:
temp_tables: dict[str, Table]
create_temp_table(name, source):
table = Table.from(source)
temp_tables[name] = table # replace=True semantics
return table
# On session garbage collection:
# all temp_tables are released
Temporary tables are visible only within the session that created them and do not affect any attached external catalogs.