11# Trino Query UI
22
3- A reusable React component for executing queries against Trino. It can be
4- embedded into any React application and configured to proxy requests to a local
5- or remote Trino cluster.
3+ A reusable React component as a query interface for the SQL query engine
4+ [ Trino] ( https://trino.io/ ) . Browse connected catalogs, write SQL queries,
5+ execute the queries and inspect result data all in a web application connected
6+ to your Trino cluster.
7+
8+ The component can be embedded into any React application and configured to proxy
9+ requests to a local or remote Trino cluster.
610
711> [ !WARNING]
812> This package is under heavy development and is not yet recommended for
@@ -12,13 +16,31 @@ or remote Trino cluster.
1216![ Trino Query UI] ( screenshot.png " Trino Query UI ")
1317
1418Implementation details:
19+
1520* React TypeScript project with Vite
1621* Uses Node.js v20+
1722* Monaco editor + ANTLR parser using the Trino language
1823
24+ ## Features
25+
26+ * Browse metadata about catalogs, schemas, tables, and more
27+ * Search across catalogs
28+ * Set queries session context.
29+ * Inspect data with generated queries
30+ * Preview sample data
31+ * Write queries manually with schema-aware SQL syntax completion and
32+ highlighting
33+ * Use multiple query tabs
34+ * View schema information in SQL queries via mouse-over hovering
35+ * Format SQL queries in the editor
36+ * Copy result set table data to the clipboard
37+ * Monitor query processing across the Trino cluster
38+
39+ See details in the [ demo animation] ( ./demos.gif ) .
40+
1941## Installation
2042
21- ```
43+ ``` shell
2244npm install trino-query-ui
2345```
2446
@@ -38,20 +60,22 @@ export default MyTrinoApp
3860## Building and shipping in Trino
3961
4062The Query UI builds just like the existing UI in Trino.
41- 1 . First you build the TypeScript into Javascript and CSS
42- 2 . Then copy the distributable path into Trino.
43- 3 . Then modify Trino to respond to the query ui path.
63+
64+ 1 . Build the TypeScript into Javascript and CSS
65+ 2 . Copy the distributable path into Trino.
66+ 3 . Modify Trino to respond to the query ui path.
4467
4568### Building for integration
4669
47- ```
70+ ``` shell
4871cd precise
72+ npm install
4973npm run build
5074```
5175
5276### Copying into Trino
5377
54- ```
78+ ``` shell
5579mkdir -p $TRINO_HOME /core/trino-main/src/main/resources/query_ui_webapp/
5680cp -r dist/* $TRINO_HOME /core/trino-main/src/main/resources/query_ui_webapp/
5781```
@@ -119,8 +143,10 @@ Add `/query/` path. Note any path can be used:
119143### Build and run
120144
1211451 . Install Node.js (v20 or newer) from < https://nodejs.org/en/download/ >
122- 2 . Install the dependencies and run the dev server:
123- ```
146+ 2 . Ensure Trino is running at the configured URL. Defaults to http://localhost:8080
147+ 3 . Install the dependencies and run the dev server:
148+
149+ ``` shell
124150cd precise
125151npm install
126152npm run dev
@@ -130,9 +156,9 @@ The local URL is displayed, and you can open it in your browser.
130156
131157### Set up proxying to a local Trino instance
132158
133- Update ` vite.config.ts ` with the following so that queries can be
134- proxied to Trino's query endpoint running on ` http://localhost:8080 ` (or any
135- other path you require).
159+ By default ` vite.config.ts ` is configured so that queries can be proxied to
160+ Trino's query endpoint running on ` http://localhost:8080 ` . Modify the setting to
161+ suit your needs with another URL and updated configuration:
136162
137163``` tsx
138164import { defineConfig } from ' vite'
@@ -157,23 +183,27 @@ export default defineConfig({
157183
158184### Building the parser
159185
160- Run ` npm run antlr4ng ` to build the parser, as configured in ** package.json** .
186+ Build the parser, as configured in ** package.json** .
187+
188+ ``` shell
189+ npm run antlr4ng
190+ ```
161191
162192### Linting and code formatting
163193
164- To check code quality and formatting:
194+ To check code quality and formatting with ESLint and Prettier, as defined in
195+ ** package.json** :
165196
166197``` shell
167- npm run check
198+ npm run check
168199```
169200
170- This command runs both ESLint and Prettier, as defined in ** package.json** .
171-
172201## Philosophy
173202
174203This UI's purpose is to provide an environment where, once the cluster is up,
175204you can immediately execute queries and explore data sets. The intended use
176205cases are:
206+
177207* Initial proof-of-concept queries.
178208* Exploration of data sets.
179209* Performance analysis.
@@ -183,6 +213,7 @@ cases are:
183213* Early demos.
184214
185215The approach:
216+
1862171 . Direct integration into the Trino UI
187218 - No need for an additional authentication hop (although it could be added
188219 in the future)
0 commit comments