Query PostgreSQL
Execute a read-only SQL SELECT query against PostgreSQL.Request
Example
Response
Safety
The endpoint enforces multiple layers of protection:- SELECT-only — only queries starting with
SELECTare allowed - Read-only connection — the JDBC connection is set to read-only mode
- Statement blocklist — queries containing
INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,TRUNCATE,GRANT,REVOKE,COPY,CALL,EXECUTE, orEXECare rejected - No stacked queries — semicolons are not allowed
- No SQL comments —
--and/* */are rejected to prevent obfuscation - LIMIT enforcement — if no
LIMITis present in the SQL, one is appended automatically using the request’slimitvalue (or the default 100). Passlimit: -1to bypass the automatic append entirely — the caller’s SQL runs as-is.
Query MongoDB
Query a MongoDB collection with optional filter and projection.Request
Example
Response
Safety
- Blocked operators — filters containing
$where,$function, or$accumulatorare rejected, as these allow arbitrary JavaScript execution - Standard MongoDB query operators (
$eq,$gt,$in,$regex, etc.) are safe and fully supported
Query Object Store
Read rows from a pipeline’s object store destination (MinIO or S3). The pipeline name selects the bucket, prefix, and credentials — the caller never supplies connection details.Request
Example
Response
"count": 0) rather than an error.
Error Cases
Returns400 Bad Request with {"error": "..."} when:
- The pipeline is not found
- The pipeline does not have an object store destination
- The pipeline’s object store configuration is missing a prefix key
- The read times out (default 90 seconds, tunable via the
DATRIS_OBJECTSTORE_QUERY_TIMEOUT_SECenvironment variable)
Query Snowflake
Execute a read-only query against the Snowflake account a pipeline loads into. The pipeline name selects the credentials, warehouse, database, and schema — credentials never leave the server.Request
Example
Response
sql field echoes the query that actually ran, including any automatically appended LIMIT.
Safety
- Read-only allowlist — queries must start with
SELECT,WITH,SHOW,DESCRIBE, orDESC.SHOW/DESCRIBEare allowed so agents can discover databases, schemas, tables, and columns. - Statement blocklist — queries containing
INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,TRUNCATE,GRANT,REVOKE,CALL,EXECUTE,EXEC,PUT,REMOVE,COPY,MERGE, orUSEare rejected (USEis blocked so a query cannot re-point the session at another database or role) - No stacked queries — semicolons are not allowed
- No SQL comments —
--and/* */are rejected to prevent obfuscation - LIMIT enforcement — if a
SELECT/WITHquery has noLIMIT, one is appended using the request’slimitvalue.SHOW/DESCRIBEoutput is row-capped at the same value. - Query timeout — 30 seconds, bounding both hung requests and warehouse spend. Not applied when
limit: -1.
Error Cases
Returns400 Bad Request with {"error": "..."} when:
- The pipeline is not found
- The pipeline does not have a Snowflake destination
- The SQL fails validation (allowlist, blocklist, semicolons, comments)
Query Databricks
Execute a read-only query against the Databricks workspace a pipeline loads into. The pipeline name selects the credentials, SQL warehouse, catalog, and schema — credentials never leave the server.Request
Example
Response
sql field echoes the query that actually ran, including any automatically appended LIMIT.
Safety
Same protections as Query Snowflake, with the blocklist extended for Databricks-specific data-movement and maintenance verbs:OPTIMIZE, VACUUM, RESTORE, CLONE, REFRESH, MSCK, and DECLARE are also rejected.
If the SQL warehouse is stopped, opening the connection blocks while it auto-starts — this happens before the 30-second query timeout applies, so the first query after idle time can take longer.
Error Cases
Returns400 Bad Request with {"error": "..."} when:
- The pipeline is not found
- The pipeline does not have a Databricks destination
- The SQL fails validation (allowlist, blocklist, semicolons, comments)
Kill Job
Kill a running pipeline job by its pipeline token. The job thread is interrupted and the job is marked as cancelled.Request
Example
Response
Error Cases
- Job not found for the given pipeline token
- Job is not in
PROCESSINGstate (already completed or cancelled) - Job thread is no longer alive
