deferred_read_csv

xorq.api.deferred_read_csv(
    path,
    con=None,
    table_name=None,
    schema=None,
    normalize_method=normalize_read_path_stat,
    **kwargs,
)

Create a deferred read operation for CSV files that will execute only when needed.

This function creates a representation of a read operation that doesn’t immediately load data into memory. Instead, it registers the operation to be performed when the resulting expression is executed.

The function works with different backend engines (pandas, duckdb, postgres, etc.) and adapts the read parameters accordingly.

Parameters

Name Type Description Default
con Backend The connection object representing the backend where the CSV will be read. This can be any backend that supports reading CSV files (pandas, duckdb, postgres, etc.). None
path str or Path The path to the CSV file to be read. This can be a local file path or a URL. required
table_name str The name to give to the resulting table in the backend. If not provided, a unique name will be generated automatically. None
schema Schema The schema definition for the CSV data. If not provided, the schema will be inferred from the data by sampling the CSV file. None
kwargs Any Additional keyword arguments that will be passed to the backend’s read_csv method. {}

Returns

Name Type Description
Expr An expression representing the deferred read operation.