

# Table functions in DuckDB

Use table functions to read files in Amazon S3 directly and to inspect the metadata of those files. You can also use them to list the databases, tables, columns, and functions that a query can use, and to generate rows of test data. A table function returns a set of rows. You call it in the `FROM` clause of a query, in place of a table name, as in `SELECT * FROM read_parquet('s3://amzn-s3-demo-bucket/data/*.parquet')`. You can filter, join, group, and sort its rows as you would the rows of a table.

The file readers, such as `read_parquet`, `read_csv`, `read_json`, and `read_avro`, return the data in files. The `read_text` and `read_blob` functions return the whole content of each file as one value. The file metadata functions, such as `parquet_metadata`, `parquet_schema`, and `avro_metadata`, return what a file records about itself in its header or footer. All of these functions take an Amazon S3 path that starts with `s3://`. Most of them also accept a path with a wildcard, such as `*`, or a list of paths.

These functions read Amazon S3 with the IAM permissions of the principal that runs the query, so the principal must have permission to read each path. The reads do not go through the AWS Glue Data Catalog, so AWS Glue and AWS Lake Formation table permissions do not apply to them. For more information about these permissions, see [Reading files by Amazon S3 path](duckdb-permissions.md#athena-duckdb-permissions-reading-files-by-amazon-s3-path).

You can also read a file by putting its quoted Amazon S3 path in place of a table name, as in `FROM 's3://amzn-s3-demo-bucket/data/orders.parquet'`. The path must end in `.parquet`, `.csv`, or `.json`, and the read works like a call to the matching reader function. It does not go through the AWS Glue Data Catalog. To set reader options, such as the file format, a header row, or the column types, call the reader function instead.

In DuckDB, a database in the AWS Glue Data Catalog is called a schema, and the catalog that holds it is called a database. The functions whose names start with `duckdb_` take no arguments and list what the query can see. The `duckdb_databases` function lists catalogs, `duckdb_schemas` lists databases, `duckdb_tables` lists tables, `duckdb_columns` lists columns, and `duckdb_functions` lists functions.

A view cannot call a table function. For more information about what a view can read, see [What a view can read](duckdb-views.md#athena-duckdb-views-what-a-view-can-read).

The examples for these functions use the tables of the `sales_db` database and the files in their Amazon S3 locations. The `sales_parquet` table is a Hive table in Parquet format at `s3://amzn-s3-demo-bucket/tables/sales_parquet/`. It has six rows and the columns `order_id`, `customer`, `region`, `amount`, and `order_date`. The `sales_csv` table is a Hive table in CSV format that is partitioned by `region`, and `sales_json` is a Hive table in JSON format. The `orders_iceberg` table is an Iceberg table with two snapshots. Its Parquet data files and Avro metadata files are under `s3://amzn-s3-demo-bucket/tables/orders_iceberg/`.

**Topics**
+ [File readers](duckdb-functions-table-file-readers.md)
+ [File metadata](duckdb-functions-table-file-metadata.md)
+ [System catalog](duckdb-functions-table-catalog-and-system.md)

The following table lists the table functions, with a link to the description of each one.


| Function | Description | 
| --- | --- | 
| [avro\_metadata](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-avro-metadata) | Returns the key-value metadata in the header of an Avro file, such as its schema and compression codec. | 
| [duckdb\_columns](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-duckdb-columns) | Lists the columns of the tables that a query can see, with their positions and data types. | 
| [duckdb\_databases](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-duckdb-databases) | Lists the catalogs that the engine has open for a query, which DuckDB calls databases. | 
| [duckdb\_functions](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-duckdb-functions) | Lists the functions in DuckDB, with their parameters and return types. | 
| [duckdb\_schemas](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-duckdb-schemas) | Lists the databases that a query can see, which DuckDB calls schemas. | 
| [duckdb\_tables](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-duckdb-tables) | Lists the tables that a query can see, with their number of columns and a `CREATE TABLE` statement for each. | 
| [glob](duckdb-functions-utility-file-listing.md#athena-duckdb-functions-utility-glob) | Lists the files in Amazon S3 whose paths match a glob pattern. The utility functions topic describes it. | 
| [icu\_calendar\_names](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-icu-calendar-names) | Lists the names of the calendar systems that the engine's International Components for Unicode (ICU) library supports. | 
| [parquet\_bloom\_probe](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-bloom-probe) | Checks whether the Bloom filters of Parquet files rule out a value in a column, for each row group. | 
| [parquet\_file\_metadata](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-file-metadata) | Returns the file-level metadata in the footers of Parquet files, such as the number of rows and row groups. | 
| [parquet\_full\_metadata](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-full-metadata) | Returns all the footer metadata of each Parquet file in one row, as lists of structs. | 
| [parquet\_kv\_metadata](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-kv-metadata) | Returns the custom key-value metadata in the footers of Parquet files. | 
| [parquet\_metadata](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-metadata) | Returns the metadata of each column chunk of Parquet files, such as its statistics, compression, and size. | 
| [parquet\_page\_index](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-page-index) | Returns the page index of Parquet files, with the location, row range, and statistics of each data page. | 
| parquet\_scan | Alias of [read\_parquet](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-parquet). | 
| [parquet\_schema](duckdb-functions-table-file-metadata.md#athena-duckdb-functions-table-parquet-schema) | Returns the schema in the footers of Parquet files, with one row for each schema element. | 
| [pragma\_version](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-pragma-version) | Returns the release line of open-source DuckDB that the engine is built from, as a table with one row. | 
| [read\_avro](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-avro) | Reads Avro files from Amazon S3 and returns their records as rows. | 
| [read\_blob](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-blob) | Reads files as binary data and returns one row for each file, with its name, content, size, and modification time. | 
| [read\_csv](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-csv) | Reads CSV and other delimited text files from Amazon S3 and returns their rows as a table. | 
| read\_csv\_auto | Alias of [read\_csv](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-csv). | 
| [read\_json](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json) | Reads JSON files from Amazon S3 and returns each JSON object as a row, with a column for each key. | 
| read\_json\_auto | Alias of [read\_json](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json). | 
| [read\_json\_objects](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json-objects) | Reads JSON files from Amazon S3 and returns each top-level JSON value whole, as one `JSON` value per row. | 
| read\_json\_objects\_auto | Alias of [read\_json\_objects](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json-objects). | 
| [read\_ndjson](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-ndjson) | Reads newline-delimited JSON files from Amazon S3, with one object on each line, and returns a column for each key. | 
| read\_ndjson\_auto | Alias of [read\_ndjson](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-ndjson). | 
| [read\_ndjson\_objects](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-ndjson-objects) | Reads newline-delimited JSON files from Amazon S3 and returns each line whole, as one `JSON` value per row. | 
| [read\_parquet](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-parquet) | Reads Apache Parquet files from Amazon S3 and returns their rows as a table. | 
| [read\_text](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-text) | Reads text files and returns one row for each file, with its name, content, size, and modification time. | 
| [repeat\_row](duckdb-functions-table-catalog-and-system.md#athena-duckdb-functions-table-repeat-row) | Returns a table that repeats one row of values a given number of times. | 
| [sniff\_csv](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-sniff-csv) | Detects the format of a CSV file and returns the options and column types that `read_csv` would use. | 