pixano.features.schemas.base_schema
BaseSchema(created_at=None, updated_at=None, **data)
Bases: LanceModel
Base class for all schemas.
All schemas should inherit from this class and therefore all elements in the dataset contains an id.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
the id of the manipulated object. |
created_at |
datetime
|
the creation date of the object. |
updated_at |
datetime
|
the last modification date of the object. |
Note
If the created_at
and updated_at
fields are not provided, they are set to the current date and time.
Raises ValidationError
if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
created_at
|
datetime | None
|
The creation date of the object. |
None
|
updated_at
|
datetime | None
|
The last modification date of the object. |
None
|
data
|
Any
|
The data of the object validated by Pydantic. |
{}
|
Source code in pixano/features/schemas/base_schema.py
dataset
property
writable
Get the dataset.
table_name
property
writable
Get the table name.
deserialize(dataset_schema_json)
staticmethod
Deserialize the dataset schema.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_schema_json
|
dict[str, str | dict[str, Any]]
|
Serialized dataset schema. |
required |
Returns:
Type | Description |
---|---|
type['BaseSchema']
|
The dataset schema. |
Source code in pixano/features/schemas/base_schema.py
model_copy(*, update=None, deep=False)
Returns a copy of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update
|
dict[str, Any] | None
|
Values to change/add in the new model. |
None
|
deep
|
bool
|
Set to |
False
|
Returns:
Type | Description |
---|---|
Self
|
New model instance. |
Source code in pixano/features/schemas/base_schema.py
model_dump(exclude_timestamps=False, **kwargs)
Dump the model to a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exclude_timestamps
|
bool
|
Exclude timestamps "created_at" and "updated_at" from the model dump. Useful for comparing models without timestamps. |
False
|
kwargs
|
Any
|
Arguments for pydantic |
{}
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
The model dump. |
Source code in pixano/features/schemas/base_schema.py
resolve_ref(ref)
Resolve a reference to a schema object in the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref
|
'SchemaRef' | 'ItemRef' | 'ViewRef' | 'EmbeddingRef' | 'EntityRef' | 'AnnotationRef' | 'SourceRef'
|
The reference to resolve. |
required |
Returns:
Type | Description |
---|---|
'BaseSchema' | 'Item' | 'View' | 'Embedding' | 'Entity' | 'Annotation' | 'Source'
|
The resolved schema object. |
Source code in pixano/features/schemas/base_schema.py
serialize()
classmethod
Serialize the table.
Source code in pixano/features/schemas/base_schema.py
is_base_schema(cls, strict=False)
Check if a class is a BaseSchema
or subclass of BaseSchema
.