thanosql.resources._file
Module Contents
Classes
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/ |
|
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/ |
|
Usage docs: https://docs.pydantic.dev/2.9/concepts/models/ |
|
Service layer for file methods. |
- class thanosql.resources._file.ContentInfo(/, **data: Any)[source]
Bases:
thanosql.resources._model.BaseModelUsage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
- __class_vars__
The names of the class variables defined on the model.
- __private_attributes__
Metadata about the private attributes of the model.
- __signature__
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __pydantic_complete__
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__
The core schema of the model.
- __pydantic_custom_init__
Whether the model has a custom __init__ function.
- __pydantic_decorators__
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__
The name of the post-init method for the model, if defined.
- __pydantic_root_model__
Whether the model is a [RootModel][pydantic.root_model.RootModel].
- __pydantic_serializer__
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_extra__
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__
The names of fields explicitly set during instantiation.
- __pydantic_private__
Values of private attributes set on the model instance.
- name: str
- format: str | None
- path: str
- type: str
- size: int | None
- writable: bool
- content: Any
- created_at: datetime.datetime
- updated_at: datetime.datetime
- class thanosql.resources._file.Content(/, **data: Any)[source]
Bases:
thanosql.resources._model.BaseModelUsage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
- __class_vars__
The names of the class variables defined on the model.
- __private_attributes__
Metadata about the private attributes of the model.
- __signature__
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __pydantic_complete__
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__
The core schema of the model.
- __pydantic_custom_init__
Whether the model has a custom __init__ function.
- __pydantic_decorators__
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__
The name of the post-init method for the model, if defined.
- __pydantic_root_model__
Whether the model is a [RootModel][pydantic.root_model.RootModel].
- __pydantic_serializer__
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_extra__
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__
The names of fields explicitly set during instantiation.
- __pydantic_private__
Values of private attributes set on the model instance.
- content_info: ContentInfo
- root: str
- class thanosql.resources._file.Size(/, **data: Any)[source]
Bases:
thanosql.resources._model.BaseModelUsage docs: https://docs.pydantic.dev/2.9/concepts/models/
A base class for creating Pydantic models.
- __class_vars__
The names of the class variables defined on the model.
- __private_attributes__
Metadata about the private attributes of the model.
- __signature__
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __pydantic_complete__
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__
The core schema of the model.
- __pydantic_custom_init__
Whether the model has a custom __init__ function.
- __pydantic_decorators__
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__
The name of the post-init method for the model, if defined.
- __pydantic_root_model__
Whether the model is a [RootModel][pydantic.root_model.RootModel].
- __pydantic_serializer__
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_extra__
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__
The names of fields explicitly set during instantiation.
- __pydantic_private__
Values of private attributes set on the model instance.
- max_size: int
- used_size: int
- avail_size: int
- class thanosql.resources._file.FileService(client: thanosql._client.ThanoSQL)[source]
Bases:
thanosql._service.ThanoSQLServiceService layer for file methods.
- get(path: str | os.PathLike | None = None, option: str | None = None) Content | None[source]
Details the information of a file or directory in the specified path.
- Parameters:
path (str or path_like) – The path to the file/directory relative to the user data root (default value is “/”, the user data root directory itself)
option (controls the behavior of the API) –
default (None): retrieves file/directory information
download: downloads a file (directory download is not possible)
- Returns:
Depending on option:
default (None): Returns a Content Pydantic object containing information on the target path
download: Downloads the requested file and returns nothing
- Return type:
Content | None
- Raises:
ThanoSQLValueError – If user attempts to download a directory (when option=”download”)
- create(path: str | os.PathLike | None = None, file: str | os.PathLike | None = None) Content[source]
Uploads a file to the workspace or creates an empty folder.
- Parameters:
path (str or path_like) – The destination path of the upload/folder creation relative to the user data root. Should point to a (would-be) directory (default value is “/”, the user data root directory itself)
file (str or PathLike, optional) – The file to be uploaded. If left empty, creates an empty folder in the given path.
- Return type:
A Content Pydantic object containing information on the created file/folder.
- Raises:
ThanoSQLValueError – If path does not point to a (would-be) directory