> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> The HDFS database engine exposes files in HDFS as read-only tables.

# HDFS

The `HDFS` database engine exposes files in HDFS as read-only tables. A table name is resolved through the [`hdfs`](/reference/functions/table-functions/hdfs) table function.

<h2 id="creating-a-database">
  Creating a database
</h2>

```sql theme={null}
CREATE DATABASE hdfs_data
ENGINE = HDFS([hdfs_host_and_root_path]);
```

`hdfs_host_and_root_path` optionally sets a base HDFS URL. When it is present, table names are paths relative to that URL. Without it, table names must be full `hdfs://` URLs.

<h2 id="usage">
  Usage
</h2>

```sql theme={null}
CREATE DATABASE hdfs_data
ENGINE = HDFS('hdfs://namenode:9000/data');

SELECT * FROM hdfs_data.`events.parquet`;
```

The schema and format are inferred in the same way as for the `hdfs` table function. The database owns no table definitions and does not support table DDL or writes.

<h2 id="access-control">
  Access control
</h2>

HDFS URLs are checked against the server's remote-host filter. Creating this database requires `READ` and `WRITE` source grants on `HDFS`, regardless of [`table_engines_require_grant`](/reference/settings/server-settings/settings/other#table_engines_require_grant), for example:

```sql theme={null}
GRANT READ, WRITE ON HDFS TO user_name;
```

See the [`SOURCES` privileges](/reference/statements/grant#sources) for version and compatibility details.

<h2 id="see-also">
  See also
</h2>

* [`hdfs` table function](/reference/functions/table-functions/hdfs)
* [Filesystem database engine](/reference/engines/database-engines/filesystem)
* [S3 database engine](/reference/engines/database-engines/s3)
