# Schema Catalog rows and declarations, importable from `agensgraph`. The methods that return and take them are on [`Connection`](connections.md#connection). ## Catalog rows See [Inspecting a graph](../../schema/inspecting.md). ```{py:currentmodule} agensgraph ``` ````{py:class} Graph(name: str, schema: str, labels: int) A graph. ```{py:attribute} name :type: str ``` ```{py:attribute} schema :type: str the schema it is stored in ``` ```{py:attribute} labels :type: int how many labels it has, built-ins included ``` ```` ````{py:class} LabelInfo(id: int, name: str, kind: str, parent: str | None) A label. Prints as `Label`. ```{py:attribute} id :type: int the label's id, the first number of its elements' identities ``` ```{py:attribute} name :type: str as stored ``` ```{py:attribute} kind :type: str `'v'` or `'e'` ``` ```{py:attribute} parent :type: str | None the label it inherits from ``` ```{py:property} is_vertex :type: bool ``` ```{py:property} is_edge :type: bool ``` ```{py:property} is_builtin :type: bool `ag_vertex` or `ag_edge`. ``` ```` ````{py:class} DeclaredProperty(label: str, name: str, type: str, nullable: bool, inherited: bool = False) A property kept in a column of its own. ```{py:attribute} label :type: str ``` ```{py:attribute} name :type: str ``` ```{py:attribute} type :type: str the server's spelling of its type ``` ```{py:attribute} nullable :type: bool ``` ```{py:attribute} inherited :type: bool whether it comes from the label's parent ``` ```` ````{py:class} Index(label: str, name: str, unique: bool, definition: str) A property index. ```{py:attribute} label :type: str ``` ```{py:attribute} name :type: str ``` ```{py:attribute} unique :type: bool ``` ```{py:attribute} definition :type: str the statement that would create it again ``` ```` ````{py:class} Constraint(label: str, name: str, unique: bool, definition: str) A uniqueness or check constraint. ```{py:attribute} label :type: str ``` ```{py:attribute} name :type: str ``` ```{py:attribute} unique :type: bool true for a uniqueness constraint ``` ```{py:attribute} definition :type: str the server's normalised rendering ``` ```` ````{py:class} GraphDescription(graph: str, labels: tuple[Label, ...], properties: dict[str, tuple[PropertyShape, ...]], triples: tuple[Triple, ...], counts: dict[str, int], meta_gathered: bool) What `describe()` returns. ```{py:attribute} graph :type: str ``` ```{py:attribute} labels :type: tuple[Label, ...] every label, as `LabelInfo` ``` ```{py:attribute} properties :type: dict[str, tuple[PropertyShape, ...]] for each label but the built-ins, its properties as `PropertyShape`s ``` ```{py:attribute} triples :type: tuple[Triple, ...] which labels each edge label connects ``` ```{py:attribute} counts :type: dict[str, int] elements per label ``` ```{py:attribute} meta_gathered :type: bool whether `triples` is current ``` ```` ````{py:class} PropertyShape(name: str, kind: str, declared: bool) A property seen on a label. ```{py:attribute} name :type: str ``` ```{py:attribute} kind :type: str its JSON type, with numbers as `integer` or `float`, or a declared column's type ``` ```{py:attribute} declared :type: bool whether it has a column of its own ``` ```` ````{py:class} Triple(start: str, edge: str, end: str, edge_count: int) An edge label and the labels it connects. ```{py:attribute} start :type: str ``` ```{py:attribute} edge :type: str ``` ```{py:attribute} end :type: str ``` ```{py:attribute} edge_count :type: int ``` ```` ## Declarations See [Declaring a schema](../../schema/declaring.md). ````{py:class} DesiredLabel(name: str, kind: str = 'v', parent: str | None = None, properties: Sequence[PromotedProperty] = ()) A label that should exist. ```{py:attribute} name :type: str ``` ```{py:attribute} kind :type: str `'v'` or `'e'` ``` ```{py:attribute} parent :type: str | None the label to inherit from ``` ```{py:attribute} properties :type: Sequence[PromotedProperty] `PromotedProperty`s to keep in columns of their own ``` ```` ````{py:class} PromotedProperty(name: str, type: str) A property to keep in a column of its own. ```{py:attribute} name :type: str ``` ```{py:attribute} type :type: str the column type, written into the statement as given ``` ```{py:method} rendered() -> str The column's definition. ``` ```` ````{py:class} DesiredIndex(label: str, properties: tuple[str | IndexElement, ...], unique: bool = False, name: str | None = None, method: str = 'btree', where: str | None = None) A property index that should exist. ```{py:attribute} label :type: str ``` ```{py:attribute} properties :type: tuple[str | IndexElement, ...] names, or `IndexElement`s ``` ```{py:attribute} unique :type: bool ``` ```{py:attribute} name :type: str | None required with `where` ``` ```{py:attribute} method :type: str `btree`, `gin`, `hnsw`, ... ``` ```{py:attribute} where :type: str | None a partial index's predicate ``` ```{py:property} elements :type: tuple[IndexElement, ...] `properties` as `IndexElement`s. ``` ```{py:method} key() -> tuple[str, str, tuple[IndexElement, ...]] What an index is matched on. ``` ```` ````{py:class} IndexElement(property: str, operator_class: str | None = None, descending: bool = False, nulls_first: bool | None = None, cast: str | None = None) One property of an index. ```{py:attribute} property :type: str ``` ```{py:attribute} operator_class :type: str | None only when not the default ``` ```{py:attribute} descending :type: bool ``` ```{py:attribute} nulls_first :type: bool | None `None` for the default ``` ```{py:attribute} cast :type: str | None a type to index the property as, such as `vector(4)` ``` ```{py:method} rendered() -> str ``` ```{py:method} resolved() -> IndexElement The same with `nulls_first` made explicit. ``` ```{py:method} nulls_come_first() -> bool ``` ```` ````{py:class} Unique(label: str, property: str, name: str | None = None) A uniqueness constraint. Named `