# Values The values the driver reads and the wrappers it sends. All are importable from `agensgraph`. ## Graph values See [Graph values](../../guide/graph-values.md). ```{py:currentmodule} agensgraph ``` ````{py:class} Vertex A vertex. Read-only, compared and hashed on its identity. ```{py:property} id :type: GraphId Its identity, a `GraphId`. ``` ```{py:property} label :type: str The label it was created with. ``` ```{py:property} properties :type: dict[str, Any] Its property map, a `dict`, decoded on first access. ``` ```{py:method} get(key: str, default: Any = None) -> Any One property, or `default`. ``` ```{py:method} properties_json() -> bytes The property map as JSON `bytes`, without decoding it if nothing has. ``` ```` ````{py:class} Edge An edge: everything a `Vertex` has, plus its endpoints. ```{py:property} start :type: GraphId The identity of the vertex it leaves. ``` ```{py:property} end :type: GraphId The identity of the vertex it enters. ``` ```` ````{py:class} Path(vertices: tuple[Vertex, ...], edges: tuple[Edge, ...]) A path: a sequence of vertex, edge, vertex, and so on. `len()` is the number of elements. ```{py:property} vertices :type: tuple[Vertex, ...] Its vertices, in order. ``` ```{py:property} edges :type: tuple[Edge, ...] Its edges, in order. ``` ```{py:property} elements :type: tuple[Vertex | Edge, ...] Vertices and edges interleaved. ``` ```{py:property} start :type: Vertex | None The first vertex, or `None` for an empty path. ``` ```{py:property} end :type: Vertex | None The last vertex, or `None` for an empty path. ``` ```{py:property} length :type: int The number of hops: of edges. ``` ```` ````{py:class} GraphId(labid: int, locid: int) An element's identity: the label's id and the element's number within the label. Prints as `labid.locid`, orders as the server does, and is sent as a `graphid`. ```{py:attribute} labid The label's id, up to `LABID_MAX`. ``` ```{py:attribute} locid The element's number in the label, up to `LOCID_MAX`. ``` ```{py:property} packed :type: int The 64-bit integer the server stores. ``` ```{py:method} from_packed(packed: int) -> GraphId :classmethod: A `GraphId` from its packed integer. ``` ```` ```{py:data} LABID_MAX :value: 65535 The largest label id. ``` ```{py:data} LOCID_MAX :value: 281474976710655 The largest element number within a label. ``` ## Values you send See [Parameters](../../guide/parameters.md). ```{py:class} Unspecified(value: str) A string sent with no type, for the server to infer from where it is used: psycopg's default behaviour, for plain SQL. Not for Cypher, where an untyped string is parsed as JSON. ``` ```{py:class} Jsonb(obj: Any) psycopg's wrapper, re-exported: send any JSON value as `jsonb`, such as a list for `UNWIND %s`. ``` ```{py:class} Label(name: str) A `str` subclass for a label or property name. It is not quoted for you: put a name into a statement with `agensgraph.cypher.quote_identifier()`. ``` ## Numbers See [Numbers](../../guide/graph-values.md#numbers). ```{py:function} read_numbers_exactly(enabled: bool = True) Read every non-integer in a property map or a `jsonb` column as a `Decimal`, for the whole process. Set it once, at startup. ``` ```{py:function} reading_numbers_exactly() -> bool Whether non-integers are read as `Decimal`. ``` ## JSON See [Handing values to something that wants JSON](../../guide/graph-values.md#handing-values-to-something-that-wants-json). ```{py:function} to_json(obj: Any) -> bytes JSON `bytes` for a value, a row or a result, copying property maps nobody read as the bytes they arrived in. ``` ```{py:function} to_builtins(obj: Any) -> Any One graph value as `dict`s and `list`s. ``` ```{py:function} json_default(obj: Any) -> Any A `default=` hook for `json.dumps`. ``` ## Notifications ````{py:class} Notify psycopg's notification, re-exported: what `notifications()` yields and a notify handler receives. ```{py:attribute} channel :type: str ``` ```{py:attribute} payload :type: str ``` ```{py:attribute} pid :type: int the process id of the session that sent it ``` ````