stupidb.core¶
StupiDB. The stupidest database you’ll ever come across.
This is project designed to illustate the concepts that underly a typical relational database implementation, starting at naive execution of table-stakes features up to rule-based query optimization.
Warning
Please do not use this for any other reason than learning. There are no guarantees here except that there will be bugs.
Classes
|
A relation representing aggregation of columns. |
|
|
|
Unique difference between two relations. |
|
Non-unique difference between two relations. |
|
A relation representing a partitioning of rows by a key. |
|
|
|
Intersection of two relations. |
|
Non-unique intersection between two relations. |
|
|
|
|
|
|
|
A relation representing appending columns to an existing relation. |
|
A relation representing column selection. |
|
An abstract relation. |
|
|
|
A relation of rows selected based on a predicate. |
|
An abstract set operation. |
|
A relation representing rows of its child sorted by one or more keys. |
|
|
|
Union between two relations. |
|
Non-unique union between two relations. |
- class stupidb.core.Aggregation(child, metrics)[source]¶
A relation representing aggregation of columns.
- class stupidb.core.GroupBy(child, group_by)[source]¶
A relation representing a partitioning of rows by a key.
- group_by¶
A callable that takes an
AbstractRow
and returns an instance oftyping.Hashable
.
- class stupidb.core.IntersectAll(left, right)[source]¶
Non-unique intersection between two relations.
- class stupidb.core.Mutate(child, projections)[source]¶
A relation representing appending columns to an existing relation.
- class stupidb.core.Projection(child, projections)[source]¶
A relation representing column selection.
- child¶
- aggregations¶
- projections¶
- class stupidb.core.Selection(child, predicate)[source]¶
A relation of rows selected based on a predicate.
- predicate¶
A callable that takes an
AbstractRow
and returns abool
.
- class stupidb.core.SortBy(child, order_by, null_ordering)[source]¶
A relation representing rows of its child sorted by one or more keys.
- order_by¶
A callable that takes an
AbstractRow
and returns an instance ofComparable
.
- null_ordering¶
Whether to place the nulls of a column first or last.