Module load.database in plugin tabular v0.5.2
Author(s) | Markus Binsteiner (markus@frkl.io) |
Tags | tabular |
Python class | kiara_plugin.tabular.modules.db.LoadDatabaseFromDiskModule |
Module configuration options
Configuration class: kiara.modules.included_core_modules.serialization.SerializeConfig
Name | Description | Type | Required? | Default |
---|---|---|---|---|
serialization_profile | The name of the serialization profile used to serialize the source value. | string | true | null |
target_profile | The profile name of the de-serialization result data. | string | true | null |
value_type | The value type of the actual (unserialized) value. | string | true | null |
constants | Value constants for this module. | object | false | null |
defaults | Value defaults for this module. | object | false | null |
Module source code
class LoadDatabaseFromDiskModule(DeserializeValueModule):
_module_type_name = "load.database"
@classmethod def retrieve_supported_target_profiles(cls) -> Mapping[str, Type]: return {"python_object": KiaraDatabase}
@classmethod def retrieve_serialized_value_type(cls) -> str: return "database"
@classmethod def retrieve_supported_serialization_profile(cls) -> str: return "copy"
def to__python_object(self, data: SerializedData, **config: Any):
assert "db.sqlite" in data.get_keys() and len(list(data.get_keys())) == 1
chunks = data.get_serialized_data("db.sqlite")
# TODO: support multiple chunks assert chunks.get_number_of_chunks() == 1 files = list(chunks.get_chunks(as_files=True, symlink_ok=True)) assert len(files) == 1
db_file = files[0]
db = KiaraDatabase(db_file_path=db_file) return db