lomas_server.utils package

Submodules

lomas_server.utils.anti_timing_att module

lomas_server.utils.collection_models module

class lomas_server.utils.collection_models.BooleanMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['boolean'])[source]

Bases: ColumnMetadata

Model for boolean column metadata

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['boolean'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

type: Literal['boolean']
class lomas_server.utils.collection_models.BoundedColumnMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None)[source]

Bases: ColumnMetadata

Model for columns with bounded data

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

validate_bounds()[source]

Validates column bounds.

class lomas_server.utils.collection_models.CategoricalColumnMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None)[source]

Bases: ColumnMetadata

Model for categorical column metadata

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

validate_categories()[source]

Makes sure number of categories matches cardinality.

class lomas_server.utils.collection_models.ColumnMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None)[source]

Bases: BaseModel

Base model for column metadata

max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None
max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None
max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

nullable: bool
private_id: bool
class lomas_server.utils.collection_models.Dataset(*, dataset_name: str, metadata: MetadataOfPathDB | MetadataOfS3DB)[source]

Bases: BaseModel

BaseModel for a dataset

dataset_name: str
metadata: MetadataOfPathDB | MetadataOfS3DB
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'dataset_name': FieldInfo(annotation=str, required=True), 'metadata': FieldInfo(annotation=Union[MetadataOfPathDB, MetadataOfS3DB], required=True, discriminator='database_type')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.DatasetOfPathDB(*, dataset_name: str, metadata: MetadataOfPathDB | MetadataOfS3DB, database_type: Literal[PrivateDatabaseType.PATH], dataset_path: str)[source]

Bases: Dataset

BaseModel for a local dataset

database_type: Literal[PrivateDatabaseType.PATH]
dataset_path: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'database_type': FieldInfo(annotation=Literal[<PrivateDatabaseType.PATH: 'PATH_DB'>], required=True), 'dataset_name': FieldInfo(annotation=str, required=True), 'dataset_path': FieldInfo(annotation=str, required=True), 'metadata': FieldInfo(annotation=Union[MetadataOfPathDB, MetadataOfS3DB], required=True, discriminator='database_type')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.DatasetOfS3DB(*, dataset_name: str, metadata: MetadataOfPathDB | MetadataOfS3DB, database_type: Literal[PrivateDatabaseType.S3], endpoint_url: str, bucket: str, key: str, credentials_name: str)[source]

Bases: Dataset

BaseModel for a dataset on S3

bucket: str
credentials_name: str
database_type: Literal[PrivateDatabaseType.S3]
endpoint_url: str
key: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'bucket': FieldInfo(annotation=str, required=True), 'credentials_name': FieldInfo(annotation=str, required=True), 'database_type': FieldInfo(annotation=Literal[<PrivateDatabaseType.S3: 'S3_DB'>], required=True), 'dataset_name': FieldInfo(annotation=str, required=True), 'endpoint_url': FieldInfo(annotation=str, required=True), 'key': FieldInfo(annotation=str, required=True), 'metadata': FieldInfo(annotation=Union[MetadataOfPathDB, MetadataOfS3DB], required=True, discriminator='database_type')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.DatasetOfUser(*, dataset_name: str, initial_epsilon: float, initial_delta: float, total_spent_epsilon: float, total_spent_delta: float)[source]

Bases: BaseModel

BaseModel for informations of a user on a dataset

dataset_name: str
initial_delta: float
initial_epsilon: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'dataset_name': FieldInfo(annotation=str, required=True), 'initial_delta': FieldInfo(annotation=float, required=True), 'initial_epsilon': FieldInfo(annotation=float, required=True), 'total_spent_delta': FieldInfo(annotation=float, required=True), 'total_spent_epsilon': FieldInfo(annotation=float, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

total_spent_delta: float
total_spent_epsilon: float
class lomas_server.utils.collection_models.DatasetsCollection(*, datasets: List[DatasetOfPathDB | DatasetOfS3DB])[source]

Bases: BaseModel

BaseModel for datasets collection

datasets: Annotated[List[DatasetOfPathDB | DatasetOfS3DB], FieldInfo(annotation=NoneType, required=True, discriminator='database_type')]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'datasets': FieldInfo(annotation=List[Union[DatasetOfPathDB, DatasetOfS3DB]], required=True, discriminator='database_type')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.DatetimeMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['datetime'], lower: datetime, upper: datetime)[source]

Bases: BoundedColumnMetadata

Model for datetime column metadata

lower: datetime
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'lower': FieldInfo(annotation=datetime, required=True), 'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['datetime'], required=True), 'upper': FieldInfo(annotation=datetime, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

type: Literal['datetime']
upper: datetime
class lomas_server.utils.collection_models.FloatMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['float'], precision: Precision, lower: float, upper: float)[source]

Bases: BoundedColumnMetadata

Model for float column metadata

lower: float
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'lower': FieldInfo(annotation=float, required=True), 'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'precision': FieldInfo(annotation=Precision, required=True), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['float'], required=True), 'upper': FieldInfo(annotation=float, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

precision: Precision
type: Literal['float']
upper: float
class lomas_server.utils.collection_models.IntCategoricalMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['int'], precision: Precision, cardinality: int, categories: List[int])[source]

Bases: CategoricalColumnMetadata

Model for integer categorical column metadata

cardinality: int
categories: List[int]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'cardinality': FieldInfo(annotation=int, required=True), 'categories': FieldInfo(annotation=List[int], required=True), 'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'precision': FieldInfo(annotation=Precision, required=True), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['int'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

precision: Precision
type: Literal['int']
class lomas_server.utils.collection_models.IntMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['int'], precision: Precision, lower: int, upper: int)[source]

Bases: BoundedColumnMetadata

Model for integer column metadata

lower: int
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'lower': FieldInfo(annotation=int, required=True), 'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'precision': FieldInfo(annotation=Precision, required=True), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['int'], required=True), 'upper': FieldInfo(annotation=int, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

precision: Precision
type: Literal['int']
upper: int
class lomas_server.utils.collection_models.Metadata(*, max_ids: Annotated[int, Gt(gt=0)], rows: Annotated[int, Gt(gt=0)], row_privacy: bool, censor_dims: bool | None = False, columns: Dict[str, Annotated[Annotated[StrMetadata, Tag(tag=string)] | Annotated[StrCategoricalMetadata, Tag(tag=categorical_string)] | Annotated[IntMetadata, Tag(tag=int)] | Annotated[IntCategoricalMetadata, Tag(tag=categorical_int)] | Annotated[FloatMetadata, Tag(tag=float)] | Annotated[BooleanMetadata, Tag(tag=boolean)] | Annotated[DatetimeMetadata, Tag(tag=datetime)], Discriminator(discriminator=get_column_metadata_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]])[source]

Bases: BaseModel

BaseModel for a metadata format

censor_dims: bool | None
columns: Dict[str, Annotated[Annotated[StrMetadata, Tag(tag=string)] | Annotated[StrCategoricalMetadata, Tag(tag=categorical_string)] | Annotated[IntMetadata, Tag(tag=int)] | Annotated[IntCategoricalMetadata, Tag(tag=categorical_int)] | Annotated[FloatMetadata, Tag(tag=float)] | Annotated[BooleanMetadata, Tag(tag=boolean)] | Annotated[DatetimeMetadata, Tag(tag=datetime)], Discriminator(discriminator=get_column_metadata_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]
max_ids: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'censor_dims': FieldInfo(annotation=Union[bool, NoneType], required=False, default=False), 'columns': FieldInfo(annotation=Dict[str, Annotated[Union[Annotated[StrMetadata, Tag], Annotated[StrCategoricalMetadata, Tag], Annotated[IntMetadata, Tag], Annotated[IntCategoricalMetadata, Tag], Annotated[FloatMetadata, Tag], Annotated[BooleanMetadata, Tag], Annotated[DatetimeMetadata, Tag]], Discriminator]], required=True), 'max_ids': FieldInfo(annotation=int, required=True, metadata=[Gt(gt=0)]), 'row_privacy': FieldInfo(annotation=bool, required=True), 'rows': FieldInfo(annotation=int, required=True, metadata=[Gt(gt=0)])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

row_privacy: bool
rows: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])]
class lomas_server.utils.collection_models.MetadataOfDataset[source]

Bases: BaseModel

BaseModel for metadata of a dataset

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.MetadataOfPathDB(*, database_type: Literal[PrivateDatabaseType.PATH], metadata_path: str)[source]

Bases: MetadataOfDataset

BaseModel for metadata of a dataset with PATH_DB

database_type: Literal[PrivateDatabaseType.PATH]
metadata_path: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'database_type': FieldInfo(annotation=Literal[<PrivateDatabaseType.PATH: 'PATH_DB'>], required=True), 'metadata_path': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

class lomas_server.utils.collection_models.MetadataOfS3DB(*, database_type: Literal[PrivateDatabaseType.S3], endpoint_url: str, bucket: str, key: str, access_key_id: str | None = None, secret_access_key: str | None = None, credentials_name: str)[source]

Bases: MetadataOfDataset

BaseModel for metadata of a dataset with S3_DB

access_key_id: str | None
bucket: str
credentials_name: str
database_type: Literal[PrivateDatabaseType.S3]
endpoint_url: str
key: str
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'access_key_id': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'bucket': FieldInfo(annotation=str, required=True), 'credentials_name': FieldInfo(annotation=str, required=True), 'database_type': FieldInfo(annotation=Literal[<PrivateDatabaseType.S3: 'S3_DB'>], required=True), 'endpoint_url': FieldInfo(annotation=str, required=True), 'key': FieldInfo(annotation=str, required=True), 'secret_access_key': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

secret_access_key: str | None
class lomas_server.utils.collection_models.Precision(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Precision of integer and float data

DOUBLE = 64
SINGLE = 32
class lomas_server.utils.collection_models.StrCategoricalMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['string'], cardinality: int, categories: List[str])[source]

Bases: CategoricalColumnMetadata

Model for categorical string metadata

cardinality: int
categories: List[str]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'cardinality': FieldInfo(annotation=int, required=True), 'categories': FieldInfo(annotation=List[str], required=True), 'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['string'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

type: Literal['string']
class lomas_server.utils.collection_models.StrMetadata(*, private_id: bool = False, nullable: bool = False, max_partition_length: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_influenced_partitions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, max_partition_contributions: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])] | None = None, type: Literal['string'])[source]

Bases: ColumnMetadata

Model for string metadata

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'max_influenced_partitions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_contributions': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'max_partition_length': FieldInfo(annotation=Union[Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=0)])], NoneType], required=False, default=None), 'nullable': FieldInfo(annotation=bool, required=False, default=False), 'private_id': FieldInfo(annotation=bool, required=False, default=False), 'type': FieldInfo(annotation=Literal['string'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

type: Literal['string']
class lomas_server.utils.collection_models.User(*, user_name: str, may_query: bool, datasets_list: List[DatasetOfUser])[source]

Bases: BaseModel

BaseModel for a user in a user collection

datasets_list: List[DatasetOfUser]
may_query: bool
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'datasets_list': FieldInfo(annotation=List[DatasetOfUser], required=True), 'may_query': FieldInfo(annotation=bool, required=True), 'user_name': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

user_name: str
class lomas_server.utils.collection_models.UserCollection(*, users: List[User])[source]

Bases: BaseModel

BaseModel for users collection

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'users': FieldInfo(annotation=List[User], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

users: List[User]
lomas_server.utils.collection_models.get_column_metadata_discriminator(v: Any) str[source]

Discriminator function for determining the type of column metadata.

Parameters:

v (Any) – The unparsed column metadata (either dict or class object)

Raises:

ValueError – If the column type cannot be found.

Returns:

The metadata string type.

Return type:

str

lomas_server.utils.config module

lomas_server.utils.error_handler module

lomas_server.utils.logger module

lomas_server.utils.query_examples module

lomas_server.utils.query_models module

Module contents