Skip to main content

load_from_dbms_metadata_dir

Function load_from_dbms_metadata_dir 

Source
pub fn load_from_dbms_metadata_dir(
    dir: &Path,
) -> Result<CatalogSnapshot, CatalogError>
Expand description

Load a catalog snapshot from a directory of DBMS_METADATA-exported .sql files.

Load a CatalogSnapshot by classifying every .sql file under dir as a single top-level CREATE DDL statement (the shape DBMS_METADATA.GET_DDL emits when written per-object to disk).

For each file:

  • The object kind is read from the leading CREATE … keyword (TABLE / VIEW / PACKAGE / PROCEDURE / FUNCTION / SEQUENCE / TRIGGER / TYPE); statements whose keyword does not match a known kind are skipped (graceful degradation per R13).
  • The owner schema is read from the optional OWNER.OBJECT prefix on the CREATE target. Unqualified statements (no OWNER. prefix) are filed under a stable PUBLIC schema interned through the regular interner — never SymbolId::new(0), which would collide with whatever the first object name happens to be.
  • The raw file bytes are stored verbatim on ObjectCommon::ddl as a DbmsMetadataDdl so downstream consumers (doc generation, lineage, the doctor’s ddl-extraction ratio) can inspect the exact source the catalog was derived from.

This classifier is keyword-shaped and does not parse arbitrary PL/SQL bodies — column definitions, parameter signatures, view projections and constraint details are not populated. When the full parser (Layer 1) lands, callers that need column- or signature-level fidelity should switch to that path; the DbmsMetadataDdl stored here is sufficient seed for re-parsing on demand without re-reading the disk.