Skip to main content

DuckDB_Connection.read_file

read_filepathasformatkey_columnsreplace_if_present

Group: Input
Aliases: import, load, open, read, sql

Documentation

Reads a file into a new table in the database and returns a query referencing the new table.

This will create a new table inside DuckDB.

Arguments

  • path: the path to the file to read. Can be a Text, URI or File object.
  • as: the name of the table to create. Defaults to "NewTable".
  • format: the format of the file to read. If not provided, it will be inferred from the file extension.
  • key_columns: the names of the columns to use as the primary key. If not provided, no primary key will be created.
  • replace_if_present: if set to True, will replace the table if it already exists.

Returns

A DB_Table referencing the newly created table.