Use ADCM to run SQL
You can use the ADCM UI to execute SQL queries.
Execute an SQL query
To execute a query, open the Clusters page, select an ADPG cluster, and switch to the Services tab. Click in the Actions column to display a list of possible actions. Select the Run SQL action. The Run SQL action executes SQL queries on behalf of the postgres
superuser.
In the opened form, specify a database and query text. The default database for queries is postgres
. Click the Database for query field to change the database.
Enter a database name in the pop-up window and click Apply.
Click the SQL query field to add SQL query text.
Enter an SQL query text in the pop-up window and click Apply.
Click Run.
Confirm the action in the opened pop-up window.
In the image above, the SQL query adds Leo Tolstoy
to the author
table and information about his book — "War and Peace" to the book
table. The author
and book
tables belong to the test books_store
database, the creation of which is described in the following article: Example of working with tables via psql.
View the result
To see the SQL query result, open the Jobs page and click the Run SQL action name.
In the opened form, switch to the ansible[check] tab and expand the Result SQL query item. The SQL query and its result are displayed.
The query result contains SQL query
,rc
, stdout
, and stderr
fields described in the table below.
Field name | Description |
---|---|
SQL query |
SQL query text |
rc |
Contains the psql exit status:
|
stdout |
Contains the psql output with the query result |
stderr |
Contains an error message if an error occurs during the query execution |