API#

The PyFDB API provides a Pythonic interface to the FDB. It is designed to give Python users direct access to core FDB concepts such as databases, archives, keys, and retrieval operations, while preserving the performance characteristics of the native implementation. The API closely mirrors the FDB data model, making it familiar to existing FDB users and straightforward to integrate into Python-based workflows. This section documents the main classes and functions available in PyFDB and explains how they map to the underlying FDB components.

FDB#

class FDB(config: str | dict | pathlib.Path | None = None, user_config: str | dict | pathlib.Path | None = None)#

Constructor for FDB object.

Parameters:
  • config (str | dict | Path | None, optional) – Config object for setting up the FDB. See Notes.

  • user_config (str | dict | Path | None, optional) – Config object for setting up user specific options, e.g., enabling sub-TOCs. See Notes.

Return type:

returns: FDB object

Note

Every config parameter but is converted accordingly depending on its type:
  • str is used as a yaml representation to parse the config

  • dict is interpreted as hierarchical format to represent a config, see example

  • Path is interpreted as a location of the config and read as a YAML file

  • None is the fallback. The default config in $FDB_HOME is loaded

Using a single PyFDB instance per individual threads is safe. Sharing the instances across threads isn’t supported. However, the underlying FDB and its methods are thread-safe; the caller needs to be aware that flush acts on all archive calls, including archived messages from other threads. A call to flush will persist all archived messages regardless from which thread the message has been archived. In case the caller wants a finer control it is advised to instantiate one FDB object per thread to ensure only messages are flushed that have been archived on the same FDB object.

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> config = {
...     "type":"local",
...     "engine":"toc",
...     "schema":"<schema_path>",
...     "spaces":[
...         {
...             "handler":"Default",
...             "roots":[
...                 {"path": "<db_store_path>"},
...             ],
...         }
...     ],
... }
>>> fdb = pyfdb.FDB(config)

Or leveraging the context manager:

>>> with pyfdb.FDB(fdb_config_path) as fdb:
...     # Call methods of fdb
...     pass
archive(data: bytes, identifier: pyfdb.pyfdb_type.MarsIdentifier | None = None)#

Archive binary data into the underlying FDB. In case an identifier is supplied, that identifier is used to archive the data. No consistency checks are applied. The caller needs to ensure the provided identifier matches metadata present in data.

If no identifier is supplied, data is interpreted as GRIB data and the metadata is taken from the GRIB messages.

In any case, the supplied or derived metadata needs to provide values for all required keys of the FDB schema.

Parameters:
  • data (bytes) – The binary data to be archived. If no key is provided this is interpreted by eccodes and may contain multiple GRIB messages.

  • identifier (Identifier | None, optional) – A unique identifier for the archived data. - If provided, the data will be stored under this identifier. - If None, the data will be archived without an explicit identifier, metadata has to be derivable from the data, which is interpreted as GRIB data.

Note

Sometimes an identifier is also referred to as a Key.

Return type:

None

Examples

>>> fdb = pyfdb.FDB()
>>> filename = data_path / "x138-300.grib"
>>> fdb.archive(data=filename.read_bytes()) # Archive
>>> fdb.archive(identifier=Identifier([("key-1", "value-1")]), data=filename.read_bytes())
>>> fdb.flush() # Sync the archive call
axes(mars_selection: pyfdb.pyfdb_type.MarsSelection, level: int = 3) pyfdb.pyfdb_iterator.IndexAxis#

Return the ‘axes’ and their extent of a MARS selection for a given level of the schema in an IndexAxis object.

If a key isn’t specified the entire extent (all values) are returned.

Parameters:
  • mars_selection (MarsSelection) – A MARS selection which specifies the affected data.

  • level (int [1-3], optional) – Level of the FDB Schema. Only keys of the given level are returned.

Returns:

A map containing Key-Value pairs of the axes and their extent

Return type:

IndexAxis

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> selection = {
...         "type": "an",
...         "class": "ea",
...         "domain": "g",
...         "expver": "0001",
...         "stream": "oper",
...         "levtype": "sfc",
...         "step": "0",
...         "time": "1800",
... }
>>> index_axis: IndexAxis = fdb.axes(selection) # level == 3
>>> for k, v in index_axis.items():
...     print(f"k={k}   | v={v}")
k=class    | v=['ea']
k=date     | v=['20200101', '20200102', '20200103', '20200104']
k=domain   | v=['g']
k=expver   | v=['0001']
k=levelist | v=['']
k=levtype  | v=['sfc']
k=param    | v=['131', '132', '167']
k=step     | v=['0']
k=stream   | v=['oper']
k=time     | v=['1800']
k=type     | v=['an']
config() tuple[dict[str, Any], dict[str, Any]]#

Return the system and user configuration of the underlying FDB.

Parameters:

None

Returns:

Python dictionaries describing the system and user configuration

Return type:

tuple[dict[str, Any], dict[str, Any]]

Examples

>>> fdb = FDB(config_file)
>>> system_config, user_config = fdb.config()
>>> print(system_config)
>>> print(user_config)
control(mars_selection: pyfdb.pyfdb_type.MarsSelection, control_action: pyfdb.pyfdb_type.ControlAction, control_identifiers: collections.abc.Collection[pyfdb.pyfdb_type.ControlIdentifier]) collections.abc.Generator[pyfdb.pyfdb_iterator.ControlElement, None, None]#

Enable certain features of FDB databases, e.g., disables or enables retrieving, list, etc.

Parameters:
  • mars_selection (MarsSelection) – A MARS selection which specifies the affected data.

  • control_action (ControlAction) – Which action should be modified, e.g., ControlAction.RETRIEVE

  • control_identifiers (list[ControlIdentifier]) – Should an action be enabled or disabled, e.g., ControlIdentifier.ENABLE or ControlIdentifier.DISABLE

Returns:

A generator for ControlElement

Return type:

Generator[ControlElement, None, None]

Note

Disabling of an ControlAction, e.g., ControlAction.RETRIEVE leads to the creation of a retrieve.lock in the corresponding FDB database. This is true for all actions. The file is removed after the Action has been disabled.

It’s important to consume the iterator, otherwise the lock file isn’t deleted which can cause unexpected behavior. Also, due to internal reuse of databases, create a new FDB object before relying on the newly set control_identifier, to propagate the status.

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> selection = {
>>>         "class": "ea",
>>>         "domain": "g",
>>>         "expver": "0001",
>>>         "stream": "oper",
>>>         "date": "20200101",
>>>         "time": "1800",
>>> }
>>> control_iterator = fdb.control(
>>>     selection,
>>>     ControlAction.DISABLE,
>>>     [ControlIdentifier.RETRIEVE],
>>> )
>>> elements = list(control_iterator)
>>> print(elements[0])
ControlElement(
    control_identifiers=[RETRIEVE],
    key={
        'class': ['ea'],
        'date': ['20200104'],
        'domain': ['g'],
        'expver': ['0001'],
        'stream': ['oper'],
        'time': ['2100']
        },
    location=/<path_to_root>/ea:0001:oper:20200104:2100:g
)
dirty()#

Return whether a flush of the FDB is needed, for example if data was archived since the last flush.

Parameters:

None

Returns:

True if an archive happened and a flush is needed, False otherwise.

Return type:

bool

Examples

>>> fdb = FDB(fdb_config_file)
>>> filename = <data_path>
>>> fdb.archive(open(filename, "rb").read())
>>> fdb.dirty()                         # == True
>>> fdb.flush()
>>> fdb.dirty()                         # == False
enabled(control_identifier: pyfdb.pyfdb_type.ControlIdentifier) bool#

Check whether a specific control identifier is enabled

Parameters:

control_identifier (ControlIdentifier) – A given control identifier

Returns:

True if the given control identifier is set, False otherwise.

Return type:

bool

Examples

>>> fdb_config = yaml.safe_load(fdb_config_path)
>>> fdb_config["writable"] = False
>>> fdb = pyfdb.FDB(fdb_config)
>>> fdb.enabled(ControlIdentifier.NONE) # == True
>>> fdb.enabled(ControlIdentifier.LIST) # == True
>>> fdb.enabled(ControlIdentifier.RETRIEVE) # == True
>>> fdb.enabled(ControlIdentifier.ARCHIVE) # == False, default True
>>> fdb.enabled(ControlIdentifier.WIPE) # == False, default True
>>> fdb.enabled(ControlIdentifier.UNIQUEROOT) # == True
flush()#

Flush all buffers and close all data handles of the underlying FDB into a consistent DB state. Always safe to call

Parameters:

None

Return type:

None

Examples

>>> fdb = pyfdb.FDB()
>>> filename = data_path / "x138-300.grib"
>>> fdb.archive(bytes=filename.read_bytes()) # Archive
>>> fdb.flush() # Data is synced
inspect(mars_selection: pyfdb.pyfdb_type.MarsSelection) collections.abc.Generator[pyfdb.pyfdb_iterator.ListElement, None, None]#

Inspects the content of the underlying FDB and returns a generator of list elements describing which field was part of the MARS selection.

Parameters:

mars_selection (MarsSelection) – An MARS selection for which the inspect should be executed

Returns:

A generator for ListElement describing FDB entries containing data of the MARS selection

Return type:

Generator[ListElement, None, None]

Examples

>>> selection = {
>>>         "type": "an",
>>>         "class": "ea",
>>>         "domain": "g",
>>>         "expver": "0001",
>>>         "stream": "oper",
>>>         "date": "20200101",
>>>         "levtype": "sfc",
>>>         "step": "0",
>>>         "param": "167",
>>>         "time": "1800",
>>>     }
>>> list_iterator = pyfdb.inspect(selection)
>>> elements = list(list_iterator) # single element in iterator
>>> elements[0]
{class=ea,expver=0001,stream=oper,date=20200101,time=1800,domain=g}
{type=an,levtype=sfc}
{param=167,step=0},
TocFieldLocation[
    uri=URI[scheme=<location>],
    offset=0,
    length=10732,
    remapKey={}
],
length=10732,
timestamp=1762537447
list(mars_selection: pyfdb.pyfdb_type.MarsSelection, include_masked: bool = False, level: int = 3) collections.abc.Generator[pyfdb.pyfdb_iterator.ListElement, None, None]#

List data present at the underlying fdb archive and which can be retrieved.

Parameters:
  • mars_selection (MarsSelection) – A MARS selection which describes the data which can be listed. If None is given, all data will be listed.

  • include_masked (bool, optional) – If True, the returned iterator lists masked data, if False the elements are unique.

  • level (int [1-3], optional) – Specifies the FDB schema level of the elements which are matching the selection. A level of 1 means return a level 1 key (of the FDB schema) which is matching the MARS selection.

Returns:

A generator for ListElement describing FDB entries containing data of the MARS selection

Return type:

Generator[ListElement, None, None]

Note

this call lists masked elements if `include_masked` is `True`.

Examples

>>> selection = {
>>>     "type": "an",
>>>     "class": "ea",
>>>     "domain": "g",
>>>     "expver": "0001",
>>>     "stream": "oper",
>>>     "date": "20200101",
>>>     "levtype": "sfc",
>>>     "step": "0",
>>>     "time": "1800",
>>> }
>>> list_iterator = pyfdb.list(selection) # level == 3
>>> elements = list(list_iterator)
>>> print(elements[0])

{class=ea,expver=0001,stream=oper,date=20200101,time=1800,domain=g} {type=an,levtype=sfc} {step=0,param=131}, tocfieldlocation[uri=uri[scheme=file,name=<location>],offset=10732,length=10732,remapkey={}], length=10732, timestamp=176253515

>>> list_iterator = pyfdb.list(selection, level=2)
>>> elements = list(list_iterator)
>>> print(elements[0])

{class=ea,expver=0001,stream=oper,date=20200101,time=1800,domain=g} {type=an,levtype=sfc}, length=0, timestamp=0

>>> list_iterator = pyfdb.list(selection, level=1)
>>> elements = list(list_iterator)
>>> print(elements[0])

{class=ea,expver=0001,stream=oper,date=20200101,time=1800,domain=g}, length=0, timestamp=0

logger#
purge(mars_selection: pyfdb.pyfdb_type.MarsSelection, doit: bool = False, porcelain: bool = False) collections.abc.Generator[pyfdb.pyfdb_iterator.PurgeElement, None, None]#

Remove duplicate data from the database.

Purge duplicate entries from the database and remove the associated data if the data is owned and not adopted. Data in the FDB5 is immutable. It is masked, but not removed, when overwritten with new data using the same key. Masked data can no longer be accessed. Indexes and data files that only contains masked data may be removed.

If an index refers to data that is not owned by the FDB (in particular data which has been adopted from an existing FDB5), this data will not be removed.

Parameters:
  • mars_selection (MarsSelection) – A MARS selection which describes the data which is purged.

  • doit (bool, optional) – If true the wipe command is executed, per default there are only dry-run

  • porcelain (bool, optional) – Restricts the output to the wiped files

Returns:

A generator for PurgeElement

Return type:

Generator[PurgeElement, None, None]

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> purge_iterator = fdb.purge({"class": "ea"}), doit=True)
>>> purged_elements = list(purge_iterator)
>>> print(purged_elements[0])
{class=ea,expver=0001,stream=oper,date=20200104,time=1800,domain=g}
{type=an,levtype=sfc}
{step=0,param=167},
TocFieldLocation[
    uri=URI[
        scheme=file,
        name=<location>
    ],
    offset=32196,
    length=10732,
    remapKey={}
],
length=10732,
timestamp=176253976
retrieve(mars_selection: pyfdb.pyfdb_type.MarsSelection) pyfdb.pyfdb_type.DataHandle#

Retrieve data which is specified by a MARS selection.

Parameters:

mars_selection – MARS selection which describes the data which should be retrieved

Note

The returned data handle doesn’t guarantee the order of the GRIB messages.

Returns:

A data handle which contains unordered GRIB messages and can be read like a BytesLike object.

Return type:

DataHandle

Examples

>>> mars_selection = {"key-1": "value-1", ...}
>>> data_handle = pyfdb.retrieve(mars_selection)
>>> data_handle.open()
>>> data_handle.read(4)
>>> data_handle.close()

Or leveraging the context manager:

>>> with pyfdb.retrieve(selection) as data_handle:
>>>     assert data_handle
>>>     assert data_handle.read(4) == b"GRIB"
stats(mars_selection: pyfdb.pyfdb_type.MarsSelection) collections.abc.Generator[pyfdb.pyfdb_iterator.StatsElement, None, None]#

Print information about FDB databases, aggregating the information over all the databases visited into a final summary.

Parameters:

mars_selection (MarsSelection) – A MARS selection which specifies the affected data.

Returns:

A generator for StatsElement

Return type:

Generator[StatsElement, None, None]

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> stats_iterator = fdb.stats(selection)
>>> for el list(stats_iterator):
>>>     print(el)
Index Statistics:
Fields                          : 3
Size of fields                  : 32,196 (31.4414 Kbytes)
Reacheable fields               : 3
Reachable size                  : 32,196 (31.4414 Kbytes)

DB Statistics: Databases : 1 TOC records : 2 Size of TOC files : 2,048 (2 Kbytes) Size of schemas files : 228 (228 bytes) TOC records : 2 Owned data files : 1 Size of owned data files : 32,196 (31.4414 Kbytes) Index files : 1 Size of index files : 131,072 (128 Kbytes) Size of TOC files : 2,048 (2 Kbytes) Total owned size : 165,544 (161.664 Kbytes) Total size : 165,544 (161.664 Kbytes)

status(mars_selection: pyfdb.pyfdb_type.MarsSelection) collections.abc.Generator[pyfdb.pyfdb_iterator.StatusElement, None, None]#

List the status of all FDB entries with their control identifiers, e.g., whether a certain database was locked for retrieval.

Parameters:

mars_selection (MarsSelection) – An MARS selection which specifies the queried data

Returns:

A generator for StatusElement describing FDB entries and their control identifier

Return type:

Generator[StatusElement, None, None]

Examples

>>> selection = {
>>>         "type": "an",
>>>         "class": "ea",
>>>         "domain": "g",
>>>     },
>>> )
>>> status_iterator = pyfdb.status(selection)
>>> elements = list(status_iterator)
>>> elements[0]
StatusElement(
    control_identifiers=[],
    key={
        'class': ['ea'],
        'type': ['an'],
        'date': ['20200104'],
        'domain': ['g'],
        'expver': ['0001'],
        'stream': ['oper'],
        'time': ['2100']
        },
    location=/<path_to_root>/ea:0001:oper:20200104:2100:g
)
wipe(mars_selection: pyfdb.pyfdb_type.MarsSelection, doit: bool = False, porcelain: bool = False, unsafe_wipe_all: bool = False) collections.abc.Generator[pyfdb.pyfdb_iterator.WipeElement, None, None]#

Wipe data from the database.

Delete FDB databases and the data therein contained. Use the passed selection to identify the database to delete. This is equivalent to a UNIX rm command. This function deletes either whole databases, or whole indexes within databases

Parameters:
  • mars_selection (MarsSelection) – An MARS selection which specifies the affected data

  • doit (bool, optional) – If true the wipe command is executed, per default there are only dry-run

  • porcelain (bool, optional) – Restricts the output to the wiped files

  • unsafe_wipe_all (bool, optional) – Flag for disabling all security checks and force a wipe

Returns:

A generator for WipeElement

Return type:

Generator[WipeElement, None, None]

Note

Wipe elements are not directly corresponding to the wiped files. This can be a cause for confusion. The individual wipe elements strings of the wipe output.

Examples

>>> fdb = pyfdb.FDB(fdb_config_path)
>>> wipe_iterator = fdb.wipe({"class": "ea"})
>>> wiped_elements = list(wipe_iterator)
...
Toc files to delete:
<path_to_database>/toc
...

FDB - Auxiliary Objects#

class DataHandle(dataHandle: pyfdb._internal._DataHandle, *, _internal=False)#

DataHandle class for lazy reading from a data source.

Parameters:

None

Note

This class can’t be instantiated / is only returned from the underlying FDB calls

Return type:

DataHandle class

Examples

>>> request = {
>>>     "type": "an",
>>>     "class": "ea",
>>>     "domain": "g",
>>>     "expver": "0001",
>>>     "stream": "oper",
>>>     "date": "20200101",
>>>     "levtype": "sfc",
>>>     "step": "0",
>>>     "param": ["167", "165", "166"],
>>>     "time": "1800",
>>> }
>>> data_handle = fdb.retrieve(request)
>>> data_handle.open()
>>> data_handle.read(4) == b"GRIB"
>>> data_handle.close()
>>> # OR
>>> with fdb.retrieve(request) as data_handle:
>>>     data_handle.read(4) == b"GRIB"
close() None#

Close the DataHandle object after reading.

Parameters:

None

Return type:

None

Examples

>>> data_handle = fdb.retrieve(request)
>>> data_handle.open()
>>> data_handle.read(4) == b"GRIB"
>>> data_handle.close()
dataHandle: pyfdb._internal._DataHandle#
open() None#

Open the DataHandle object for reading.

Parameters:

None

Return type:

None

Examples

>>> data_handle = fdb.retrieve(request)
>>> data_handle.open()
>>> data_handle.read(4) == b"GRIB"
>>> data_handle.close()
opened = False#
read(len: int = -1) bytes#

Read a given amount of bytes from the DataHandle. This method copies the data from the underlying memory.

Parameters:

len (int) – Number of bytes to read. Defaults to -1, which reads the entire buffer. If the requested size exceeds the available data, the result is zero-padded to match the requested size.

Return type:

bytes object resembling the read data.

Raises:

RuntimeError

Examples

>>> with fdb.retrieve(request) as data_handle
>>>     data_handle.read(4) == b"GRIB"
>>>     #or
>>>     data_handle.read(-1) # Read the entire file
readall(buffer_size: int = 1024) bytes#

Read all bytes from the DataHandle into memory. This method copies the data from the underlying memory.

Parameters:

buffer_size (int) – The size of the buffer which is used for reading

Note

There is no need to open the DataHandle before. This is handled by the function. The default chunk size is 1024 bytes.

Return type:

bytes object resembling the read data

Examples

>>> data_handle = fdb.retrieve(request)
>>> data_handle.readall() # Returns all content of a datahandle b"GRIB..."
readinto(buffer: memoryview) int#

Read a given amount of bytes from the DataHandle into a memoryview. This is a zero-copy method.

Parameters:

buffer (memoryview) – Memory view for the buffer in which the bytes should be read

Return type:

int size of bytes which have been read

Raises:

RuntimeError

Examples

>>> dst_read_into = io.BytesIO(b"")
>>> with fdb.retrieve(selection) as data_handle:
>>>     assert data_handle
>>>     shutil.copyfileobj(data_handle, dst_read_into)
>>>     # Reset position in file
>>>     dst_read_into.seek(0)
size() int#

Return the size of a data handle in bytes.

Parameters:

None

Return type:

int describing the size of the datahandle in bytes.

Examples

>>> with fdb.retrieve(selection) as data_handle:
>>>     data_handle.size() # Returns the size of the datahandle in bytes
class ControlAction#

Specify which action should be executed, e.g. DISABLE or ENABLE.

Values#

  • NONE

  • DISABLE

  • ENABLE

Initialize self. See help(type(self)) for accurate signature.

DISABLE#
ENABLE#
NONE = 0#
class ControlIdentifier#

Specify which functionality of the FDB should be addressed, e.g. RETRIEVE or LIST.

Values#

  • NONE

  • LIST

  • RETRIEVE

  • ARCHIVE

  • WIPE

  • UNIQUEROOT

Initialize self. See help(type(self)) for accurate signature.

ARCHIVE#
LIST#
NONE = 0#
RETRIEVE#
UNIQUEROOT#
WIPE#

FDB - Iterator Objects#

class ControlElement(control_element: pyfdb._internal.ControlElement, *, _internal=False)#
controlIdentifiers() list[pyfdb.pyfdb_type.ControlIdentifier]#
element: pyfdb._internal.ControlElement#
key() pyfdb.pyfdb_type.MarsSelection#
location() pyfdb.pyfdb_type.URI#
class IndexAxis(index_axis: pyfdb._internal.IndexAxis | pyfdb.pyfdb_type.MarsSelection)#

IndexAxis class representing axes and their extent. The class implements all Dictionary functionalities. Key are the corresponding FDB keys (axes) and values are the values defining the extent of an axis.

clear()#
has_key(k) bool#
items() collections.abc.ItemsView[str, collections.abc.Collection[str]]#
keys() collections.abc.KeysView[str]#
values() collections.abc.ValuesView[collections.abc.Collection[str]]#
class ListElement(list_element: pyfdb._internal.ListElement, *, _internal=False)#

Element returned from a listing command

combined_key() dict[str, str]#

Return the MARS keys of the ListElement

Returns:

Dictionary containing all metadata for the ListElement

Return type:

dict[str, str]

Note

Depending on the level specified in the list command, the returned dictionary contains all available keys from schema levels up to and including the requested level; keys that exist only at deeper levels are omitted.

Examples

>>> list_iterator = fdb.list(selection, level=3)
>>> assert list_iterator
>>> elements = list(list_iterator)
>>> for element in elements:
>>>     print(element.combined_key())

Output:

``#

{ ‘class’: ‘ea’, ‘date’: ‘20200104’, … , ‘type’: ‘an’ } … ``

property data_handle: pyfdb.pyfdb_type.DataHandle | None#

Access the DataHandle

Returns:

Data Handle for accessing the data of the list element

Return type:

DataHandle

Examples

>>> data_handle = list_element.data_handle
>>> if data_handle is not None:
>>>     data_handle.open()
>>>     data_handle.read(4)
>>>     data_handle.close()

Output:

b"GRIB"

has_location() bool#

Does the ListElement have a location

Returns:

True if this element has a location, False otherwise.

Return type:

bool

Note

Only for `ListElement`s which are on the third level of the schema.

keys() list[dict[str, str]]#

Return the MARS keys of the ListElement separated by their level in the schema.

Returns:

List containing MARS keys and their values for the ListElement. The keys are split by their level in the schema

Return type:

list[dict[str, str]]

Note

Depending on the level specified in the list command, the returned dictionary contains all available keys from schema levels up to and including the requested level; keys that exist only at deeper levels are omitted.

Examples

>>> list_iterator = fdb.list(selection, level=3)
>>> assert list_iterator
>>> elements = list(list_iterator)
>>> for element in elements:
>>>     print(element.keys())

Output:

``#

[{‘class’: ‘ea’, … , ‘time’: ‘2100’}, {‘levtype’: ‘sfc’, ‘type’: ‘an’}, {‘param’: ‘167’, ‘step’: ‘0’}] … ``

length() int | None#

Size of the ListElement within the file associated.

Returns:

Size in bytes in the data file of the FDB, if ListElement is on level 3, None otherwise.

Return type:

Optional[int]

Note

Only for `ListElement`s which are on the third level of the schema.

offset() int | None#

Offset within the file associated with the ListElement

Returns:

Offset in bytes in the data file of the FDB, if ListElement is on level 3, None otherwise.

Return type:

Optional[int]

Note

Only for `ListElement`s which are on the third level of the schema.

property uri: pyfdb.pyfdb_type.URI | None#

Access the URI of the list element

Returns:

URI of the data

Return type:

URI

Examples

>>> uri = list_element.uri
>>> print(uri)

Output:

<path/to/data_file>

class PurgeElement(purge_element: str, *, _internal=False)#
element: pyfdb._internal.PurgeElement#
class StatsElement(stats_element: pyfdb._internal.StatsElement, *, _internal=False)#
db_statistics() str#
element: pyfdb._internal.StatsElement#
index_statistics() str#
class StatusElement(control_element: pyfdb._internal.ControlElement, *, _internal=False)#
controlIdentifiers() list[pyfdb.pyfdb_type.ControlIdentifier]#
element: pyfdb._internal.ControlElement#
key() pyfdb.pyfdb_type.MarsSelection#
location() pyfdb.pyfdb_type.URI#
class WipeElement(wipe_element: str, *, _internal=False)#
msg() str#
type() WipeElementType#
uris() list[pyfdb.pyfdb_type.URI]#