Function | collate | Collate the given objects according to a key function. |
Function | get_type | Return the type of the given object. |
Function | gen_reload_queries | Prepare queries to reload the given objects. |
Function | reload | Reload a large number of objects efficiently. |
Function | load | Load a large number of objects efficiently. |
Function | load_referencing | Load objects of object_type that reference owning_objects. |
Function | load_related | Load objects of object_type referred to by owning_objects. |
Function | dbify_value | Convert a value into a form that Storm can compile directly. |
Function | dbify_column | Convert a column into a form that Storm can compile directly. |
Function | create | Create a large number of objects efficiently. |
Function | _primary_key | Get a primary key our helpers can use. |
Function | _make_compound_load_clause | Construct a bulk-loading query clause for a compound primary key. |
Generates (common-key-value, list-of-things) tuples, like groupby, except that the given objects do not need to be sorted.
If the given object is wrapped by a security proxy, the type returned is that of the wrapped object.
:raises AssertionError if the key is missing or unusable.
When the primary key is compound, we expect that in practice we will
often want to load objects with common leading elements of the key: for
example, we often want to load many GitRef
objects from the same
repository. This helper returns a query clause optimised to be compact
in this case.
Parameters | primary_key | The primary key columns. |
values_list | A sequence of values of the primary key whose corresponding rows should be loaded. This must be sorted by the caller (because this function calls itself recursively, and it's usually more efficient to sort the whole sequence in one go). |
Note that complex types like Person are best loaded through dedicated helpers that can eager load other related things (e.g. validity for Person).
Parameters | object_type | The object type to load - e.g. BranchSubscription. |
owning_objects | The objects which are referenced. E.g. [Branch()] At this point, all the objects should be of the same type, but that constraint could be lifted in future. | |
reference_keys | A list of attributes that should be used to select object_type keys. e.g. ['branchID'] | |
extra_conditions | A list of Storm clauses that will be used in the final query. | |
Returns | A list of object_type where any of reference_keys refered to the primary key of any of owning_objects. |
Note that complex types like Person are best loaded through dedicated helpers that can eager load other related things (e.g. validity for Person).
Parameters | object_type | The object type to load - e.g. Person. |
owning_objects | The objects holding the references. E.g. Bug. | |
foreign_keys | A list of attributes that should be inspected for keys. e.g. ['ownerID'] |
Parameters | columns | The Storm columns to insert values into. Must be from a single class. |
values | A list of lists of values for the columns. | |
get_objects | Return the created objects. | |
get_primary_keys | Return the created primary keys. | |
Returns | A list of the created objects if get_created, otherwise None. |