Implementation:Eventual Inc Daft Session Create Table
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, Catalog_Management |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Concrete tool for creating persistent named tables in a catalog through a Daft Session provided by the Daft library.
Description
The create_table method on Session creates a table in the current catalog. It requires a current catalog to be set, otherwise a ValueError is raised. If the identifier is a string, it is parsed into an Identifier. If the identifier has only one part (just a table name), the current namespace is prepended for full qualification. The method delegates to the catalog's create_table implementation with the resolved identifier, source, and properties.
Usage
Call sess.create_table("table_name", df) on a Session instance after setting a catalog and namespace. Use for persistent table creation in external catalogs.
Code Reference
Source Location
- Repository: Daft
- File:
daft/session.py - Lines: L280-299
Signature
def create_table(
self,
identifier: Identifier | str,
source: Schema | DataFrame,
**properties: Any,
) -> Table
Import
from daft.session import Session
sess = Session()
sess.create_table("catalog.namespace.table", df)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| identifier | str | Yes | Table identifier. Can be fully qualified (catalog.namespace.table) or just a table name (uses current namespace). |
| source | DataFrame | Yes | Table schema or DataFrame to create the table from. |
| **properties | Any | No | Additional catalog-specific properties for table creation. |
Outputs
| Name | Type | Description |
|---|---|---|
| return | Table | The newly created Table instance in the current catalog. |
Usage Examples
Basic Usage
from daft.session import Session
import daft
sess = Session()
sess.attach_catalog(my_iceberg_catalog, "iceberg")
sess.set_catalog("iceberg")
sess.set_namespace("analytics")
df = daft.from_pydict({"id": [1, 2, 3], "value": ["a", "b", "c"]})
table = sess.create_table("my_table", df)