aiida.storage.sqlite_dos package#
Storage implementation using Sqlite database and disk-objectstore container.
Submodules#
Storage implementation using Sqlite database and disk-objectstore container.
- class aiida.storage.sqlite_dos.backend.SqliteDosMigrator(profile: Profile)[源代码]#
-
Storage implementation using Sqlite database and disk-objectstore container.
This storage backend is not recommended for use in production. The sqlite database is not the most performant and it does not support all the
QueryBuilder
functionality that is supported by thecore.psql_dos
storage backend. This storage is ideally suited for use cases that want to test or demo AiiDA as it requires no server but just a folder on the local filesystem.- __annotations__ = {}#
- __module__ = 'aiida.storage.sqlite_dos.backend'#
- class aiida.storage.sqlite_dos.backend.SqliteDosStorage(profile: Profile)[源代码]#
-
A lightweight backend intended for demos and testing.
This backend implementation uses an Sqlite database and
- class Model(*, filepath: str = None)[源代码]#
基类:
BaseModel
Model describing required information to configure an instance of the storage.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | typing_extensions.Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator]', '__signature__': 'ClassVar[Signature]', 'filepath': 'str', 'model_computed_fields': 'ClassVar[dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[ConfigDict]', 'model_fields': 'ClassVar[dict[str, FieldInfo]]'}#
- __dict__#
- __module__ = 'aiida.storage.sqlite_dos.backend'#
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model'>, 'config': {'title': 'Model'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model'>), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model'>>]}, 'ref': 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model:94461383105984', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filepath': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default_factory': <function SqliteDosStorage.Model.<lambda>>, 'schema': {'function': {'function': <bound method SqliteDosStorage.Model.filepath_is_absolute of <class 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Model', 'type': 'model-fields'}, 'type': 'model'}#
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'filepath_is_absolute': Decorator(cls_ref='aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model:94461383105984', cls_var_name='filepath_is_absolute', func=<bound method SqliteDosStorage.Model.filepath_is_absolute of <class 'aiida.storage.sqlite_dos.backend.SqliteDosStorage.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('filepath',), mode='after', check_fields=None))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})#
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
- __pydantic_parent_namespace__: ClassVar[dict[str, Any] | None] = {'__doc__': 'A lightweight backend intended for demos and testing.\n\n This backend implementation uses an Sqlite database and\n ', '__module__': 'aiida.storage.sqlite_dos.backend', '__qualname__': 'SqliteDosStorage', 'migrator': <pydantic._internal._model_construction._PydanticWeakRef object>}#
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x000055e9812f5dc0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "filepath": SerField { key_py: Py( 0x00007fca00c72900, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x00007fc9f5c0f740, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 1, }, ), has_extra: false, root_model: false, name: "Model", }, ), definitions=[])#
- __pydantic_validator__: ClassVar[SchemaValidator] = SchemaValidator(title="Model", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "filepath", lookup_key: Simple { key: "filepath", py_key: Py( 0x00007fc9f5c17df0, ), path: LookupPath( [ S( "filepath", Py( 0x00007fc9f5c17db0, ), ), ], ), }, name_py: Py( 0x00007fca00c72900, ), validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x00007fc9f5c0f740, ), ), on_error: Raise, validator: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc9f5c17100, ), config: Py( 0x00007fc9f5c17d80, ), name: "function-after[filepath_is_absolute(), str]", field_name: None, info_arg: false, }, ), validate_default: false, copy_default: false, name: "default[function-after[filepath_is_absolute(), str]]", undefined: Py( 0x00007fc9fe69f560, ), }, ), frozen: false, }, ], model_name: "Model", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x000055e9812f5dc0, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007fc9fe69f560, ), name: "Model", }, ), definitions=[], cache_strings=True)#
- __signature__: ClassVar[Signature] = <Signature (*, filepath: str = None) -> None>#
- __weakref__#
list of weak references to the object (if defined)
- _abc_impl = <_abc._abc_data object>#
- 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]] = {'filepath': FieldInfo(annotation=str, required=False, default_factory=<lambda>, title='Directory of the backend', description='Filepath of the directory in which to store data for this backend.')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.storage.sqlite_dos.backend'#
- _abc_impl = <_abc._abc_data object>#
- _initialise_session()[源代码]#
Initialise the SQLAlchemy session factory.
Only one session factory is ever associated with a given class instance, i.e. once the instance is closed, it cannot be reopened.
The session factory, returns a session that is bound to the current thread. Multi-thread support is currently required by the REST API. Although, in the future, we may want to move the multi-thread handling to higher in the AiiDA stack.
- property authinfos#
Return the collection of authorisation information objects
- property comments#
Return the collection of comments
- property computers#
Return the collection of computers
- get_backend_entity(model) BackendEntity [源代码]#
Return the backend entity that corresponds to the given Model instance.
- get_repository() DiskObjectStoreRepositoryBackend [源代码]#
Return the object repository configured for this backend.
- property groups#
Return the collection of groups
- classmethod initialise(profile: Profile, reset: bool = False) bool [源代码]#
Initialise the storage backend.
This is typically used once when a new storage backed is created. If this method returns without exceptions the storage backend is ready for use. If the backend already seems initialised, this method is a no-op.
- 参数:
reset – If
true
, destroy the backend if it already exists including all of its data before recreating and initialising it. This is useful for example for test profiles that need to be reset before or after tests having run.- 返回:
True
if the storage was initialised by the function call,False
if it was already initialised.
- property logs#
Return the collection of logs
- migrator#
- property nodes#
Return the collection of nodes
- query() SqliteQueryBuilder [源代码]#
Return an instance of a query builder implementation for this backend
- property users#
Return the collection of users