Skip to content
ClickHouse Docs

HDFS

Autogenerated from ClickHouse system tables

The HDFS database engine exposes files in HDFS as read-only tables. A table name is resolved through the hdfs table function.

Creating a database

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.

Usage

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.

Access control

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, for example:

GRANT READ, WRITE ON HDFS TO user_name;

See the SOURCES privileges for version and compatibility details.

See also

Syntax

ENGINE = HDFS([hdfs_host_and_root_path])

Related

  • S3
  • Filesystem