Skip to Content

Postgres

Postgres icon
Community

Tools to query and explore a postgres database

Author:Arcade
Version:0.6.0
Auth:No authentication required
4tools
4require secrets
PyPI VersionPython VersionsWheel StatusDownloadsLicense

Postgres provider enables read-only exploration and querying of a PostgreSQL database within the Arcade toolkit. It provides schema discovery, table inspection, and constrained SELECT execution to build reliable, safe queries.

Capabilities

  • Discover database schemas and table structures to drive query composition rather than guessing table/column names.
  • Execute read-only SELECT queries with enforced construction rules (explicit columns, ORDER BY, LIMIT/OFFSET, JOIN/HAVING/WHERE clauses).
  • Require discovery of tables and schemas before executing queries to prevent errors and ensure correct joins.
  • Enforce safe query conventions: no SELECT *, case-insensitive and trimmed string matching, prefer LIKE, join only on indexed or primary-key columns.

Secrets

  • Secret type: password. Example secret: POSTGRES_DATABASE_CONNECTION_STRING (e.g. postgres://user:password@host:5432/dbname) used to authenticate and connect; store and handle securely.

Available tools(4)

4 of 4
Tool nameDescriptionSecrets
Discover all the schemas in the postgres database.
1
Discover all the tables in the postgres database when the list of tables is not known. ALWAYS use this tool before any other tool that requires a table name.
1
You have a connection to a postgres database. Execute a SELECT query and return the results against the postgres database. No other queries (INSERT, UPDATE, DELETE, etc.) are allowed. ONLY use this tool if you have already loaded the schema of the tables you need to query. Use the <GetTableSchema> tool to load the schema if not already known. The final query will be constructed as follows: SELECT {select_query_part} FROM {from_clause} JOIN {join_clause} WHERE {where_clause} HAVING {having_clause} ORDER BY {order_by_clause} LIMIT {limit} OFFSET {offset} When running queries, follow these rules which will help avoid errors: * Never "select *" from a table. Always select the columns you need. * Always order your results by the most important columns first. If you aren't sure, order by the primary key. * Always use case-insensitive queries to match strings in the query. * Always trim strings in the query. * Prefer LIKE queries over direct string matches or regex queries. * Only join on columns that are indexed or the primary key. Do not join on arbitrary columns.
1
Get the schema/structure of a postgres table in the postgres database when the schema is not known, and the name of the table is provided. This tool should ALWAYS be used before executing any query. All tables in the query must be discovered first using the <DiscoverTables> tool.
1

Selected tools

No tools selected.

Click "Show all tools" to add tools.

Requirements

Select tools to see requirements

#

Postgres.DiscoverSchemas

Discover all the schemas in the postgres database.

Parameters

No parameters required.

Requirements

Secrets:POSTGRES_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Postgres.DiscoverTables

Discover all the tables in the postgres database when the list of tables is not known. ALWAYS use this tool before any other tool that requires a table name.

Parameters

ParameterTypeReq.Description
schema_namestringOptionalThe database schema to discover tables in (default value: 'public')

Requirements

Secrets:POSTGRES_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Postgres.ExecuteSelectQuery

You have a connection to a postgres database. Execute a SELECT query and return the results against the postgres database. No other queries (INSERT, UPDATE, DELETE, etc.) are allowed. ONLY use this tool if you have already loaded the schema of the tables you need to query. Use the <GetTableSchema> tool to load the schema if not already known. The final query will be constructed as follows: SELECT {select_query_part} FROM {from_clause} JOIN {join_clause} WHERE {where_clause} HAVING {having_clause} ORDER BY {order_by_clause} LIMIT {limit} OFFSET {offset} When running queries, follow these rules which will help avoid errors: * Never "select *" from a table. Always select the columns you need. * Always order your results by the most important columns first. If you aren't sure, order by the primary key. * Always use case-insensitive queries to match strings in the query. * Always trim strings in the query. * Prefer LIKE queries over direct string matches or regex queries. * Only join on columns that are indexed or the primary key. Do not join on arbitrary columns.

Parameters

ParameterTypeReq.Description
select_clausestringRequiredThis is the part of the SQL query that comes after the SELECT keyword wish a comma separated list of columns you wish to return. Do not include the SELECT keyword.
from_clausestringRequiredThis is the part of the SQL query that comes after the FROM keyword. Do not include the FROM keyword.
limitintegerOptionalThe maximum number of rows to return. This is the LIMIT clause of the query. Default: 100.
offsetintegerOptionalThe number of rows to skip. This is the OFFSET clause of the query. Default: 0.
join_clausestringOptionalThis is the part of the SQL query that comes after the JOIN keyword. Do not include the JOIN keyword. If no join is needed, leave this blank.
where_clausestringOptionalThis is the part of the SQL query that comes after the WHERE keyword. Do not include the WHERE keyword. If no where clause is needed, leave this blank.
having_clausestringOptionalThis is the part of the SQL query that comes after the HAVING keyword. Do not include the HAVING keyword. If no having clause is needed, leave this blank.
group_by_clausestringOptionalThis is the part of the SQL query that comes after the GROUP BY keyword. Do not include the GROUP BY keyword. If no group by clause is needed, leave this blank.
order_by_clausestringOptionalThis is the part of the SQL query that comes after the ORDER BY keyword. Do not include the ORDER BY keyword. If no order by clause is needed, leave this blank.
with_clausestringOptionalThis is the part of the SQL query that comes after the WITH keyword when basing the query on a virtual table. If no WITH clause is needed, leave this blank.

Requirements

Secrets:POSTGRES_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
#

Postgres.GetTableSchema

Get the schema/structure of a postgres table in the postgres database when the schema is not known, and the name of the table is provided. This tool should ALWAYS be used before executing any query. All tables in the query must be discovered first using the <DiscoverTables> tool.

Parameters

ParameterTypeReq.Description
schema_namestringRequiredThe database schema to get the table schema of
table_namestringRequiredThe table to get the schema of

Requirements

Secrets:POSTGRES_DATABASE_CONNECTION_STRING

Output

Type:arrayNo description provided.
Last updated on