Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Eventual Inc Daft Session Attach Catalog

From Leeroopedia


Knowledge Sources
Domains Data_Engineering, Data_Catalog
Last Updated 2026-02-08 00:00 GMT

Overview

Concrete tool for attaching an external catalog to a Daft session provided by the Daft library.

Description

The attach_catalog method on a Daft Session accepts a catalog instance (either a Daft Catalog or a supported external catalog object) and registers it with the session under an optional alias. If the provided object is not already a Daft Catalog, it is automatically wrapped using Catalog._from_obj(). The alias defaults to the catalog's name if not specified. Once attached, the catalog's tables become accessible through the session for SQL queries and DataFrame operations.

Usage

Import and use this method when you need to connect an external data catalog (Iceberg, Unity, Gravitino) to a Daft session for unified table access.

Code Reference

Source Location

  • Repository: Daft
  • File: daft/session.py
  • Lines: L187-200

Signature

def attach_catalog(self, catalog: Catalog | object, alias: str | None = None) -> Catalog

Import

from daft.session import Session

sess = Session()
sess.attach_catalog(catalog)

I/O Contract

Inputs

Name Type Required Description
catalog object Yes A Daft Catalog instance or a supported external catalog object (e.g., PyIceberg catalog)
alias None No Optional alias for name resolution; defaults to the catalog's name

Outputs

Name Type Description
return Catalog The Daft Catalog instance that was attached to the session

Usage Examples

Basic Usage

from daft.session import Session
from daft.catalog import Catalog

# Create a session and attach an Iceberg catalog
sess = Session()
iceberg_catalog = Catalog.from_iceberg(pyiceberg_catalog)
attached = sess.attach_catalog(iceberg_catalog, alias="my_catalog")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment