stupidb.row¶
Module containing classes for representing rows.
Classes
|
The base immutable row type of StupidDB. |
|
A concrete |
|
A concrete |
- class stupidb.row.AbstractRow(piece, *pieces, _id=- 1, _hash=None)[source]¶
The base immutable row type of StupidDB.
This is the primitive immutable tuple type of the objects that are in user facing APIs. They behave nearly identically to a standard
typing.Mapping
, with the exception that they are hashable and values can be accessed with square-bracket syntax as well as dot notation.- pieces¶
One or more mappings that make up row. One for most relations, and two for joins.
- _id¶
The index of this row in a table. This a private field whose details are subject to change without notice.
- _hash¶
The hash of the row’s data. This stored on the instance to avoid recomputation in
SetOperation
instances, for example.
- class stupidb.row.JoinedRow(left, right, *, _id=- 1, _hash=None)[source]¶
A concrete
AbstractRow
subclass for two-child relations.This row type is used to represent rows of a relation with two children. Currently this is only used for
Join
relations.Note
JoinedRow
is the row type yielded when iterating over an instance ofJoin
. If you want to consume the rows of a join and there are overlapping column names in the left and right relations you must select from theleft
andright
attributes of instances of this class to disambiguate.- left¶
A row from the left relation
- right¶
A row from the right relation
- classmethod from_mapping(*args, **kwargs)[source]¶
Raise an error.
A
JoinedRow
cannot be constructed from an arbitrarytyping.Mapping
.- Return type
- class stupidb.row.Row(piece, *pieces, _id=- 1, _hash=None)[source]¶
A concrete
AbstractRow
subclass for single child relations.