liveBook · Manning

To_table

As explained in DuckDB in Action

to_table is a DuckDB Python relation method that materializes a relation as a named database table.

to_table materializes a DuckDB Python relation as a named table. It performs a CREATE TABLE AS SELECT operation, avoiding repeated reads from a remote CSV source. section 6.2.1

Persist a relation snapshot

population.to_table("population") population_table = con.table("population") population_table.count("*").show() The resulting table can be queried through the relational API and returns instantly because it stores a snapshot of the data available when created. section 6.2.1

How DuckDB in Action covers it

How deep it goes
Explains the underlying CREATE TABLE AS SELECT behavior and snapshot semantics, but does not detail storage internals.
Examples
Demonstrates materializing population, reopening it with con.table, and counting its rows.
What it assumes
Assumes a DuckDB Python relation such as one created with read_csv and teaches table persistence from that starting point.
What you can do after
Operate/configure a DuckDB relation as a persistent named table and reuse it through the relational API.
How it connects
Connects DuckDB Python API relations with CSV ingestion, tables, snapshots, and the relational API.

This explainer was generated by Manning's knowledge graph from the text of DuckDB in Action. The section links point to the parts of the book it draws on.