SQL Table Reference Extractor
database.sql_extract_tables
Overview
You pass a SQL statement and we report tables, common table expressions, column references (when requested), and write targets with role and access mode. We do not resolve schemas or expand SELECT *. Do not use this when you need column lineage or schema-qualified expansion.
Regex table lists miss writes and CTEs. We walk the parse tree so you see what the statement actually references.
Reliability
STRICT within the pinned parser (max 2,000 table references). Domain errors (not retryable — fix input): SQL_PARSE_FAILED (SQL does not parse for the dialect — correct the statement; retrying unchanged input will not succeed); SQL_DIALECT_UNSUPPORTED (dialect not in the supported list — choose a supported dialect); SQL_REFERENCE_LIMIT_EXCEEDED (more than 2,000 references — shorten or split the statement); SQL_PARSE_LIMIT_EXCEEDED (statement exceeds 200,000 characters or nesting depth 32 — reduce size or complexity).
Context footprint
One call returns tables, writes, CTEs, and wildcard flags for your gate logic. A successful call costs 1 execution credit.
When to use it
When you need referenced tables, CTEs, or write targets before allowing execution.
When you need schema-aware column expansion or cross-query lineage.
Powered by JSqlParser, an open-source SQL parser used to walk the statement AST and collect table references.
Scope
Non-goals
- Does not resolve schemas or expand wildcards
- Does not prove read-only intent at runtime
- Does not build full column lineage graphs
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- Output may reveal sensitive derived information
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| sql | string | Yes | Bounded SQL source parsed without execution. |
| dialect | string | No | SQL dialect; omit it for generic. |
| options | object | No | Purpose-bound bounded extraction option object; omit it for safe defaults. It contains from 0 through 1,000 purpose-bound properties — unconstrained RFC 8259 JSON items. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| statementType | string | Yes | Parsed SQL statement type. |
| tables | array | Yes | Bounded table-reference receipts. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| ctes | array | Yes | Bounded common-table-expression receipts. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| columns | array | Yes | Bounded resolved column-reference receipts. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| writes | array | Yes | Bounded write-target receipts. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| hasWildcard | boolean | Yes | Whether a wildcard column selection appears. |
| unresolvedColumns | array | Yes | Bounded unresolved column receipts. The item shape is defined by the nested schema and the array contains from 0 through 100000 items. |
| findings | array | Yes | Bounded array of safe structured database findings. The item shape is defined by the nested schema and the array contains from 0 through 20000 items. |
| _meta | object | Yes | Closed extraction metadata receipt. Its documented receipt properties are bounded to 128 entries — unconstrained RFC 8259 JSON items. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"database.sql_extract_tables","input":{"sql":"SELECT 1","dialect":"postgresql"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("database.sql_extract_tables", {"sql":"SELECT u.name FROM users u JOIN orders o ON o.user_id = u.id","dialect":"postgresql"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| SQL_PARSE_FAILED | 400 | No | The request payload failed this skill's input validation. |
| SQL_DIALECT_UNSUPPORTED | 400 | No | The skill does not support the requested variant. |
| SQL_REFERENCE_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| SQL_PARSE_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not resolve schemas or expand wildcards
- Does not prove read-only intent at runtime
- Does not build full column lineage graphs
- Schema-qualified column expansion
- Semantic data lineage across pipelines
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "database.sql_extract_tables",
"input": {
"sql": "SELECT u.name FROM users u JOIN orders o ON o.user_id = u.id",
"dialect": "postgresql"
}
}Examples
Join lists both source tables with no writes
{
"sql": "SELECT u.name FROM users u JOIN orders o ON o.user_id = u.id",
"dialect": "postgresql"
}{
"unresolvedColumns": [],
"statementType": "SELECT",
"writes": [],
"tables": [
{
"name": "orders",
"access": "READ",
"role": "SOURCE"
},
{
"name": "users",
"access": "READ",
"role": "SOURCE"
}
],
"columns": [],
"findings": [],
"ctes": [],
"_meta": {
"referenceCount": 2,
"resolveAliases": true,
"parserProfile": "jsqlparser-5.3"
},
"hasWildcard": false
}Insert surfaces the write target
{
"sql": "INSERT INTO audit_log (msg) VALUES ('x')",
"dialect": "postgresql"
}{
"unresolvedColumns": [],
"statementType": "INSERT",
"writes": [
{
"name": "audit_log",
"access": "WRITE"
}
],
"tables": [
{
"name": "audit_log",
"access": "WRITE",
"role": "TARGET"
}
],
"columns": [],
"findings": [],
"ctes": [],
"_meta": {
"referenceCount": 1,
"resolveAliases": true,
"parserProfile": "jsqlparser-5.3"
},
"hasWildcard": false
}Recommended use cases
- Gate read-only agents by checking the writes array is empty
- Inventory tables touched by a migration script
- Pre-flight review before granting query access
Avoid for
- Schema-qualified column expansion
- Semantic data lineage across pipelines
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.