Skip to content

Commit 18cef11

Browse files
committed
Add documentation for file-based metastore
1 parent b835409 commit 18cef11

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

presto-docs/src/main/sphinx/connector.rst

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from different data sources.
1717
connector/deltalake
1818
connector/druid
1919
connector/elasticsearch
20+
connector/file-based-metastore
2021
connector/googlesheets
2122
connector/hana
2223
connector/hive
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
====================
2+
File-Based Metastore
3+
====================
4+
5+
.. contents::
6+
:local:
7+
:backlinks: none
8+
:depth: 1
9+
10+
Overview
11+
^^^^^^^^
12+
13+
For testing or developing purposes, Presto can be configured to use a local
14+
filesystem directory as a Hive Metastore.
15+
16+
The file-based metastore works only with the following connectors:
17+
18+
* :doc:`/connector/deltalake`
19+
* :doc:`/connector/hive`
20+
* :doc:`/connector/hudi`
21+
* :doc:`/connector/iceberg`
22+
23+
Configuring a File-Based Metastore
24+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
26+
1. In ``etc/catalog/``, find the catalog properties file for the supported
27+
connector.
28+
29+
2. In the catalog properties file, set the following properties:
30+
31+
.. code-block:: none
32+
33+
hive.metastore=file
34+
hive.metastore.catalog.dir=file:///<catalog-dir>
35+
36+
Replace ``<catalog-dir>`` in the example with the path to a directory on an
37+
accessible filesystem.
38+
39+
Using a File-Based Warehouse
40+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41+
42+
For this example, assume the Hive connector is being used, and the properties
43+
in the Hive connector catalog file are set to the following:
44+
45+
.. code-block:: none
46+
47+
connector.name=hive
48+
hive.metastore=file
49+
hive.metastore.catalog.dir=file:///data/hive_data/
50+
51+
Create a schema
52+
53+
.. code-block:: none
54+
55+
CREATE SCHEMA hive.warehouse;
56+
57+
This query creates a directory ``warehouse`` in the directory set for
58+
``hive.metastore.catalog.dir``, so the path to the new directory is
59+
``/data/hive_data/warehouse``.
60+
61+
Create a table with any connector-supported file formats. For example, if the
62+
Hive connector is being configured:
63+
64+
.. code-block:: none
65+
66+
CREATE TABLE hive.warehouse.orders_csv("order_name" varchar, "quantity" varchar) WITH (format = 'CSV');
67+
CREATE TABLE hive.warehouse.orders_parquet("order_name" varchar, "quantity" int) WITH (format = 'PARQUET');
68+
69+
These queries create folders as ``/data/hive_data/warehouse/orders_csv`` and
70+
``/data/hive_data/warehouse/orders_parquet``. Users can insert and query
71+
from these tables.

presto-docs/src/main/sphinx/installation/deployment.rst

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Deploying Presto
77
:backlinks: none
88
:depth: 1
99

10+
.. _Installing Presto:
11+
1012
Installing Presto
1113
-----------------
1214

0 commit comments

Comments
 (0)