Back to Yugabyte Db

file_fdw extension

docs/content/v2.25/additional-features/pg-extensions/extension-file-fdw.md

2026.1.0.0-b25729 B
Original Source

The file_fdw module provides the foreign-data wrapper file_fdw, which can be used to access data files in the server's file system, or to execute programs on the server and read their output.

To enable the extension:

sql
CREATE EXTENSION file_fdw;

Create a foreign server:

sql
CREATE SERVER my_server FOREIGN DATA WRAPPER file_fdw;

Now, you can create foreign tables that access data from files. For example:

sql
CREATE FOREIGN TABLE employees (id int, employee_name varchar) SERVER my_server OPTIONS (filename 'employees.csv', format 'csv');

You can execute SELECT statements on the foreign tables to access the data in the corresponding files.