Skip to main content

DuckDB_Connection.read_spatial_file

read_spatial_filepathaskey_columnsreplace_if_present

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

Documentation

Reads a spatial file into a new table in the database and returns a query referencing the new table. An RTree index will be created on the spatial columns automatically.

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".
  • 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.