Capstan.Snapshot.Tables (Capstan v1.2.1)

Copy Markdown View Source

Resolves a tables: :all snapshot set to a concrete, scoped table list (ROADMAP C2b).

:all (which arises when the capture allowlist is itself :all) resolves to the server's base tables outside the system schemas, enumerated from information_schema.TABLES:

  • TABLE_TYPE = 'BASE TABLE' — views (VIEW) and information_schema dictionaries (SYSTEM VIEW) are excluded;
  • TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys') — the four MySQL 8.0 system schemas are excluded;
  • temporary tables never appear in information_schema.TABLES (MySQL 8.0 reference manual, INFORMATION_SCHEMA.TABLES: "The TABLES table does not list TEMPORARY tables").

The result is ordered (schema, then table) so the resolved set is deterministic. An empty result refuses :snapshot_no_base_tables — an "everything" snapshot that finds nothing is a misconfiguration (wrong server or missing privileges), not a silent no-op. All returned names are the server's own strings (structural identity, the allowlisted telemetry class); the SQL embeds no user value.

Summary

Functions

Enumerates the scoped base tables over an established query connection. Returns {:ok, [{schema, table}]} (ordered, deduplicated by construction), {:error, :snapshot_no_base_tables} when the server exposes none, or a value-free enumeration fault.

Functions

resolve_all(query)

@spec resolve_all(Capstan.Query.t()) ::
  {:ok, [{String.t(), String.t()}]}
  | {:error, :snapshot_no_base_tables | :snapshot_table_enumeration_failed}

Enumerates the scoped base tables over an established query connection. Returns {:ok, [{schema, table}]} (ordered, deduplicated by construction), {:error, :snapshot_no_base_tables} when the server exposes none, or a value-free enumeration fault.