co3.components package¶
- Dev note:
Any reason to have ComposeableComponents and Relations as separate types? The thought is that there may be some possible Component types we want to be able to Compose that wouldn’t logically be Relations. But the gap here might be quite small
- class co3.components.ComposableComponent(name, obj)[source]¶
Bases:
Component
,Generic
Components that can be composed with others of the same type.
- class co3.components.Relation(name, obj)[source]¶
Bases:
ComposableComponent
,Generic
Relation base for tabular components to be used in relation DB settings. Attempts to adhere to the set-theoretic base outlined in the relational model [1]. Some terminology:
Relation: table-like container | -> Heading: set of attributes | | -> Attribute: column name | -> Body: set of tuples with domain matching the heading | | -> Tuple: collection of values
[1]: https://en.wikipedia.org/wiki/Relational_model#Set-theoretic_formulation
- Note: development tasks
As it stands, the Relation skeleton is incredibly lax compared to the properties and operations that should be formally available, according its pure relational algebra analog.
Relations are also generic up to a type T, which ultimately serves as the base object for Relation instances. We aren’t attempting to implement some generally useful table-like class here; instead we’re just exposing a lightweight interface that’s needed for a few CO3 contexts, and commonly off-loading most of the heavy-lifting to true relation objects like SQLAlchemy tables.
- class co3.components.SQLTable(name, obj)[source]¶
Bases:
Relation
[SQLTableLike
]- classmethod from_table(table)[source]¶
Note that the sa.Table type is intentional here; not all matching types for SQLTableLike have a defined
name
property