Skip to content

graflo.architecture.onto_sql

Classes

ColumnInfo

Bases: BaseModel

Column information from PostgreSQL table.

Source code in graflo/architecture/onto_sql.py
class ColumnInfo(BaseModel):
    """Column information from PostgreSQL table."""

    name: str
    type: str
    description: str = ""
    is_nullable: str = "YES"
    column_default: str | None = None
    is_pk: bool = False
    is_unique: bool = False
    ordinal_position: int | None = None
    sample_values: list[str] = []
    """Up to 5 sample values from the column (first rows); empty for vertex/edge ColumnInfo."""

Attributes

column_default = None class-attribute instance-attribute
description = '' class-attribute instance-attribute
is_nullable = 'YES' class-attribute instance-attribute
is_pk = False class-attribute instance-attribute
is_unique = False class-attribute instance-attribute
name instance-attribute
ordinal_position = None class-attribute instance-attribute
sample_values = [] class-attribute instance-attribute

Up to 5 sample values from the column (first rows); empty for vertex/edge ColumnInfo.

type instance-attribute

EdgeTableInfo

Bases: BaseModel

Edge table information from schema introspection.

Source code in graflo/architecture/onto_sql.py
class EdgeTableInfo(BaseModel):
    """Edge table information from schema introspection."""

    name: str
    schema_name: str
    columns: list[ColumnInfo]
    primary_key: list[str]
    foreign_keys: list[ForeignKeyInfo]
    source_table: str
    target_table: str
    source_column: str
    target_column: str
    relation: str | None = None

Attributes

columns instance-attribute
foreign_keys instance-attribute
name instance-attribute
primary_key instance-attribute
relation = None class-attribute instance-attribute
schema_name instance-attribute
source_column instance-attribute
source_table instance-attribute
target_column instance-attribute
target_table instance-attribute

ForeignKeyInfo

Bases: BaseModel

Foreign key relationship information.

Source code in graflo/architecture/onto_sql.py
class ForeignKeyInfo(BaseModel):
    """Foreign key relationship information."""

    column: str
    references_table: str
    references_column: str | None = None
    constraint_name: str | None = None

Attributes

column instance-attribute
constraint_name = None class-attribute instance-attribute
references_column = None class-attribute instance-attribute
references_table instance-attribute

RawTableInfo

Bases: BaseModel

Raw table metadata: all tables with columns, types, and constraint metadata.

Source code in graflo/architecture/onto_sql.py
class RawTableInfo(BaseModel):
    """Raw table metadata: all tables with columns, types, and constraint metadata."""

    name: str
    schema_name: str
    description: str = ""
    """The table's comment, when the engine stores one."""
    columns: list[ColumnInfo]
    primary_key: list[str]
    foreign_keys: list[ForeignKeyInfo]
    row_count_estimate: int | None = None
    """Approximate row count from pg_class.reltuples (updated by ANALYZE)."""

Attributes

columns instance-attribute
description = '' class-attribute instance-attribute

The table's comment, when the engine stores one.

foreign_keys instance-attribute
name instance-attribute
primary_key instance-attribute
row_count_estimate = None class-attribute instance-attribute

Approximate row count from pg_class.reltuples (updated by ANALYZE).

schema_name instance-attribute

SchemaIntrospectionResult

Bases: BaseModel

Result of PostgreSQL schema introspection.

Source code in graflo/architecture/onto_sql.py
class SchemaIntrospectionResult(BaseModel):
    """Result of PostgreSQL schema introspection."""

    vertex_tables: list[VertexTableInfo]
    edge_tables: list[EdgeTableInfo]
    raw_tables: list[RawTableInfo]
    schema_name: str

Attributes

edge_tables instance-attribute
raw_tables instance-attribute
schema_name instance-attribute
vertex_tables instance-attribute

VertexTableInfo

Bases: BaseModel

Vertex table information from schema introspection.

Source code in graflo/architecture/onto_sql.py
class VertexTableInfo(BaseModel):
    """Vertex table information from schema introspection."""

    name: str
    schema_name: str
    columns: list[ColumnInfo]
    primary_key: list[str]
    foreign_keys: list[ForeignKeyInfo]

Attributes

columns instance-attribute
foreign_keys instance-attribute
name instance-attribute
primary_key instance-attribute
schema_name instance-attribute