From 139520e51c3b7f8c3fd5c4c553dd13e12ffd744d Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 15 Oct 2021 14:16:06 -0400 Subject: Database python api --- python/filemetadata.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/filemetadata.py') diff --git a/python/filemetadata.py b/python/filemetadata.py index a8c738c2..0f74aa19 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -29,6 +29,7 @@ from .enums import SaveOption from . import associateddatastore #required for _FileMetadataAssociatedDataStore from .log import log_error from . import binaryview +from . import database ProgressFuncType = Callable[[int, int], bool] ViewName = str @@ -244,6 +245,14 @@ class FileMetadata: return None return binaryview.BinaryView(file_metadata = self, handle = view) + @property + def database(self) -> Optional['database.Database']: + """Gets the backing Database of the file""" + handle = core.BNGetFileMetadataDatabase(self.handle) + if handle is None: + return None + return database.Database(handle=handle) + @property def saved(self) -> bool: """Boolean result of whether the file has been saved (Inverse of 'modified' property) (read/write)""" -- cgit v1.3.1