Documentation

Graphtia documentation · workflow

Explore SQL schemas and declarations

Read PostgreSQL, MySQL and SQLite declarations, inspect table relationships and distinguish source facts from a live database.

Read one connected relationship map

Illustrative relationship mapOne view of code, an API and its declared data

Start with the endpoint, find its declaring handler, then inspect function calls, SQL operations and table declarations. The arrows retain each relationship’s direction.

Confirmed staticInferred table match
  1. getOrder() to GET /orders/:idDeclares endpoint · Confirmed staticDECLARES_API_HANDLER
  2. getOrder() to loadOrder()Calls · Confirmed staticCALLS
  3. getOrder() to loadCustomer()Calls · Confirmed staticCALLS
  4. loadOrder() to Read orderDeclares SQL operation · Confirmed staticDECLARES_DB_OPERATION
  5. loadCustomer() to Read customerDeclares SQL operation · Confirmed staticDECLARES_DB_OPERATION
  6. Read order to public.ordersReads table · InferredREADS_TABLE
  7. Read customer to public.customersReads table · InferredREADS_TABLE
  8. public.orders to public.customersForeign key · Confirmed staticFOREIGN_KEY
  9. schema.sql to public.ordersDeclares table · Confirmed staticDECLARES_TABLE
  10. schema.sql to public.customersDeclares table · Confirmed staticDECLARES_TABLE

Coverage is a separate question. A result may be partial even when an individual relationship is confirmed. Inspect coverage, completeness and limitations alongside each edge’s evidence strength.

Original explanatory illustration, not an Explorer screenshot or a captured query. Names are examples. The schema is an indexed SQL source file, not a live database connection; inferred reads do not prove execution. The foreign key points from orders to customers.

This original illustration connects an endpoint, its declaring handler, function calls, SQL operations and two tables declared in one SQL file. The handler points toward the endpoint it declares; the foreign key points from orders to customers. Table-read matches remain inferred.

Analyze declarations, without connecting

Explorer reads indexed SQL source files. It does not ask for a database password, open a database connection, execute queries or apply migrations. Its graph describes declared structure and source relationships, not the current contents or effective schema of a running server.

Open a SQL source

  1. Choose API & DB, then Database schemas, in the indexed workspace.

  2. Find the SQL source and open it. Check the source identity and current revision.

  3. Start with automatic dialect detection. If the source is unknown or ambiguous, select PostgreSQL, MySQL or SQLite explicitly for that source.

  4. Inspect Tables, Indexes and Routines & changes. Open the source evidence for the item that matters.

  5. Use Table graph for declared structure, or Tables + code to inspect supported linked code. Read uncertainty notices before following a relationship.

Explorer SQL view with PostgreSQL explicitly selected, public.orders, three fields, one index, two changes and Partial analysis notices.
With PostgreSQL explicitly selected, Explorer shows public.orders with three declared fields, one index and two change declarations. The visible Related declarations section preserves possible CREATE/ALTER matches and Partial analysis notices; execution and the resulting database schema remain unknown.

Supported declaration detail

  • Tables and columns: names, types, declared nullability, primary/unique/foreign keys and bounded defaults.

  • Indexes: supported simple index declarations, source column order and explicit ASC/DESC where present.

  • PostgreSQL identity columns, quoted identifier case, and bounded function/procedure/trigger declaration headers.

  • Recognized ALTER TABLE actions such as add, drop, rename, default and nullability changes, retained as declarations with their own source evidence.

  • Supported CHECK expressions have bounded structural evidence with complete, partial or unknown status. Routine bodies, unsupported expressions and unmodeled options retain their limits; recording a declaration does not execute or enforce it.

Automatic dialect selection

Automatic detection starts with recognizable SQL syntax. When supported source evidence proves how a migration is invoked, Explorer can also show a context-derived dialect. A directory name or driver dependency alone is insufficient. Portable SQL can remain unknown, and conflicting evidence can be ambiguous. An explicit selection does not certify the syntax or the live database. Read the detection evidence and incomplete-reading notices.

Relationships between migrations

CREATE and ALTER declarations can be shown with possible target relationships. A unique scoped candidate is still a static candidate. Repeated names, separate schemas, missing scope, temporary tables or incomplete input can leave several candidates or no resolved target. File order alone does not establish execution order or a final applied schema.

In API & DB → Database schemas, open a SQL source, then Routines & changes. Expand an ALTER declaration and review Related declarations before opening its source. Candidate labels describe the available scope; they do not claim that a migration has executed.

Illustrative exampleA possible target is not execution history

Within an explicitly declared scope, the ALTER statement can identify a candidate CREATE declaration. The two facts stay separate.

ALTER declaration
ALTER TABLE app.items ADD COLUMN label TEXT;
CREATE declaration
CREATE TABLE app.items(id INTEGER);
Candidate within the declared call

Matching scope supports the candidate. The original CREATE still declares only id.

A candidate does not establish migration order or an applied database state. Without sufficient scope, matches can remain ambiguous.

Limits by database family

  • PostgreSQL: supported source names are normalized according to quoted/unquoted identifier rules; runtime search paths, overload resolution and applied migrations are not inferred.

  • MySQL: bounded table/index declarations; dynamic SQL and unsupported compound bodies stay partial.

  • SQLite: bounded declarations; runtime pragmas, database contents and trigger execution are not inspected.

  • This guide does not claim SQL Server/T-SQL, Oracle PL/SQL, MongoDB or a universal database connector.

Follow a table into code

Open Database uses in code or the table’s code action. A source declaration and a code reference are separate observations. Read the database-code guide before treating a name match as the same table.

Agent query

Ask a connected agent to read the exact SQL source with get_db_schema, report its dialect, columns, keys and completeness, and cite ranges. Never ask it to convert an unresolved match into a verified live table.

Compose declared migrations only when their order is known

When a single-scope ordered plan is established by source evidence, Explorer can build a bounded declared composition. It starts from a declared model, not an observed database. Unordered migration files remain candidate relationships; filename order alone is not proof of execution order. No migration is applied.

Inspect CHECK expressions with supplied samples

An optional analysis can evaluate supported CHECK expressions against explicitly supplied typed samples. Results preserve unknowns and SQL’s three-valued behavior. This does not test INSERT conversion, defaults, complete row validity or enforcement by a real server. Only supply data you intend to expose to the querying client.

Use this through a connected agent with the optional analysis explicitly enabled. Start with the returned identity of the exact CHECK declaration and supply typed values. The supported request accepts at most 32 sample rows with at most 64 values per row. There is no native sample-entry form implied by this example.

Illustrative exampleNULL and a missing value are different

Evaluate this supported expression against supplied values. Evaluation status and SQL truth answer different questions.

Supplied expression
CHECK (x > 0)
x = 1
Evaluation
Evaluated
SQL truth
TRUE

Satisfied for this expression

x = -1
Evaluation
Evaluated
SQL truth
FALSE

Not satisfied

x = NULL
Evaluation
Evaluated
SQL truth
UNKNOWN

Satisfied under SQL CHECK truth rules

x omitted
Evaluation
Cannot evaluate
SQL truth
Not established

Missing input is not treated as NULL

Illustration of opt-in agent analysis. It does not validate a complete row, apply defaults or execute an insertion.

Compare with an imported schema

An optional comparison can contrast declarations or a proved migration plan with DDL you supply. It reports supported differences with their source and uncertainty. The imported text is not a verified live snapshot; missing or partial information is not evidence that the deployed database matches. Explorer does not connect to a database to obtain it.

This is an opt-in agent analysis. Supply the DDL with its origin, dialect and completeness information. Keep the indexed source and supplied text separate when reading the differences.

Illustrative exampleCompare declarations while keeping both origins

The indexed SQL and the DDL supplied for review remain distinct inputs. These three differences are selected examples from the comparison.

Indexed declarations
CREATE TABLE t (
  id INTEGER,
  label TEXT DEFAULT 'old',
  CONSTRAINT positive CHECK (id > 0)
);
CREATE INDEX ix ON t(label);
DDL supplied for review
CREATE TABLE t (
  id BIGINT,
  label TEXT DEFAULT 'new',
  extra INTEGER,
  CONSTRAINT positive CHECK (id > 1)
);
  • t.idINTEGER → BIGINTChanged definition
  • t.extraOnly in supplied DDLINTEGER column
  • ixAbsent from supplied DDLIndex on t(label)

Supplied DDL is not a verified live schema. Missing, partial or unsupported input can leave the comparison incomplete.

Put the evidence in context

Graphtia

This page is on its way. Join the waitlist to hear what’s next for Graphtia.

Join waitlist