View as Markdown
Incorta icon

Incorta ACTION

Execute SQL Query

Executes a custom SQL query against an Incorta tenant via SQLi, Incorta's SQL Interface, which exposes the tenant as a PostgreSQL-wire-protocol database. Use this for ad hoc reporting or data exploration against Incorta's Business Schema tables and materialized views. Incorta SQLi is primarily a read/query interface (it is not a general-purpose transactional database) — expect SELECT statements with standard ANSI SQL: joins, aggregates, GROUP BY, window functions, and CTEs all work. Use List Schemas, List Tables, and List Columns first if you don't already know the available schema/table/column names. Always include a LIMIT (and select only the columns you need) for exploratory queries: results are capped at Max Rows (default 500), and the response reports truncated: true when more rows existed than were returned, so a truncated result is partial (the total row count is not known; run a COUNT(*) if you need it). Narrow the query with LIMIT, filters, or aggregates rather than relying on the cap. Do not use OFFSET: Incorta SQLi silently ignores it and returns the same rows again, with no error. To read the next page of a large result, use keyset paging instead: ORDER BY <unique column> and WHERE <column> > <last value seen> with LIMIT, e.g. SELECT * FROM sales.orders WHERE order_id > 1000 ORDER BY order_id LIMIT 100. Example: SELECT region, SUM(amount) AS total_sales FROM sales.sales_fact GROUP BY region ORDER BY total_sales DESC LIMIT 50 returns {rows: [{region, total_sales}, ...], rowCount, truncated: false}, one row per region. Requires a SQLi Username and Password (mixed-mode authentication, obtained from your Incorta administrator), supplied either as props or saved on the connected Incorta account; props take precedence. The SQLi host/port and tenant database are resolved automatically. See the documentation
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Incorta account once, then configure and run Execute SQL Query from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "incorta-execute-sql-query",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    incorta: { authProvisionId: "apn_xxxxxxx" },
    username: "SQLi Username",
    password: "SQLi Password",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Execute SQL Query inputs
Property Type Description
username SQLi Username string
Username for SQLi authentication, e.g. pipedream_reader. Separate from the REST API bearer token. Optional if a SQLi username is saved on the connected account; this value takes precedence.
Optional
password SQLi Password string
Password for SQLi authentication, paired with SQLi Username. Optional if a SQLi password is saved on the connected account; this value takes precedence.
Optional
port SQLi Port integer
Port to connect to for SQLi, e.g. 5812. Optional — takes precedence over a port saved on the connected account, and over the port returned by Incorta's /configs/sqlConnection endpoint.
Optional
sql SQL Query sql
The SQL query to execute against Incorta via SQLi, e.g. SELECT * FROM sales.sales_fact LIMIT 50. See our docs to learn more about working with SQL in Pipedream
Required
maxRows Max Rows integer
Maximum number of rows to return, e.g. 100. The action stops reading once more rows than this have arrived and reports truncated. It does not change or limit the query itself, so add a LIMIT to the SQL as well.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
incorta-execute-sql-query
Version
0.0.1
App
Incorta
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes