Record Views
record_views
Module for managing Kaleidoscope record views and their operations.
This module provides classes and services for interacting with record views in the Kaleidoscope system.
Classes:
| Name | Description |
|---|---|
RecordTransfer |
TypedDict defining the structure for transferring records with key field values. |
ViewField |
TypedDict defining the structure for view fields with data and lookup field references. |
RecordView |
Model representing a record view with methods for extending views. |
RecordViewsService |
Service class for managing record view operations and API interactions. |
Example
views = client.record_views.get_record_views()
for view in views:
print(f"View: {view.view_name}, Entity Slice: {view.entity_slice_id}")
# View: Customer Records, Entity Slice: abc-123-def
# View: Product Catalog, Entity Slice: xyz-456-ghi
RecordTransfer
ViewField
RecordView
Bases: _KaleidoscopeBaseModel
Represents a view of records in the Kaleidoscope system.
A RecordView defines how records are displayed and accessed, including the entity slice they belong to, associated programs and operations, and the fields visible in the view.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
UUID of the record view |
entity_slice_id |
str
|
ID of the entity slice this view belongs to. |
program_ids |
list[str]
|
List of program IDs associated with this view. Defaults to empty list. |
operation_ids |
list[str] | None
|
Optional list of operation IDs associated with this view. |
operation_definition_ids |
list[str] | None
|
Optional list of operation definition IDs. |
view_fields |
list[ViewField]
|
List of fields visible in this view. Defaults to empty list. |
Classes:
| Name | Description |
|---|---|
ExtendViewBody |
TypedDict defining the body for extending a record view. |
Methods:
| Name | Description |
|---|---|
extend_view |
Extends the current record view by adding a key field. |
ExtendViewBody
Bases: TypedDict
TypedDict defining the body for extending a record view.
Attributes:
| Name | Type | Description |
|---|---|---|
new_key_field_name |
str
|
The name of the new key field to add. |
records_to_transfer |
list[RecordTransfer] | None
|
A list of records to transfer with their new key values. |
extend_view
extend_view(body: ExtendViewBody) -> None
Extends the current record view by adding a key field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
ExtendViewBody
|
The request body containing information about the key field to add. |
required |
Source code in kalpy/record_views.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
RecordViewsService
RecordViewsService(client: KaleidoscopeClient)
Service class for managing record views in Kaleidoscope.
This service provides methods to interact with record views, including retrieving, creating, and managing RecordView objects. It handles the conversion of raw data into RecordView instances and ensures proper client association.
Example
views = client.record_views.get_record_views()
for view in views:
print(f"View: {view.view_name}, Entity Slice: {view.entity_slice_id}")
# View: Customer Records, Entity Slice: abc-123-def
# View: Product Catalog, Entity Slice: xyz-456-ghi
Methods:
| Name | Description |
|---|---|
get_record_views |
Retrieves a list of record views available in the workspace. |
Source code in kalpy/record_views.py
129 130 | |
get_record_views
cached
get_record_views() -> list[RecordView]
Retrieves a list of record views available in the workspace.
This method caches its values.
Returns:
| Type | Description |
|---|---|
list[RecordView]
|
List[RecordView]: A list of RecordView objects representing the record views in the workspace. |
Note
If an exception occurs during the API request, it logs the error, clears the cache, and returns an empty list.
Source code in kalpy/record_views.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |