The SQL Editor allows you to run queries on your Hydra databases directly from the Hydra dashboard.

To use the SQL Editor:

  1. Navigate to the Hydra Dashboard.
  2. Select your project.
  3. Select SQL Editor.
  4. Enter a query into the editor and click the green triangle to execute and view the results.

Example Query

You can use the following queries to try the SQL Editor. The queries creates a table, adds data, and retrieves the data from the table.

CREATE TABLE IF NOT EXISTS playing_with_hydra (
	id SERIAL PRIMARY KEY,
	name TEXT NOT NULL, value REAL
);

INSERT INTO playing_with_hydra(name, value)
SELECT LEFT(md5(i::TEXT), 10), random()
FROM generate_series(1, 10) s(i);

SELECT * FROM playing_with_hydra;

Run each statement by clicking the green triangle next to each query.

When querying objects such as tables and columns with upper case letters in their name, remember to enclose the identifier name in quotes. For example: SELECT * FROM "Company". Postgres changes identifier names to lower case unless they are quoted. The same applies when creating objects in Postgres. For example, CREATE TABLE DEPARTMENT(id INT) creates a table named department in Postgres. For more information about how quoted and unquoted identifiers are treated by Postgres, see Identifiers and Key Words in the PostgreSQL documentation.

Save Queries

The SQL Editor allows you to save your queries.

To save a query:

  1. Enter the query into the editor.
  2. Enter a name for the query at the top of the page.
  3. Click Save Query to save the query.

The query is added to the Saved Queries list in the left pane of the SQL Editor. You can fetch a previously saved query by selecting it from the list.

You can rename a query at any time by modifying the name and clicking Save Query.

You can delete or duplicate a saved query by selecting the action from the options menu associated with the saved query.

To clear the editor, click New Query.