dbzero.get_config()
Retrieves the active configuration settings for the dbzero instance. ⚙️
This method allows you to inspect the configuration that is currently in use, which includes both the parameters you provided during dbzero.init() and any default values for parameters you didn't specify.
Parameters
This method does not take any parameters.
Returns
A dict containing the current configuration key-value pairs.
autocommit(bool):Trueif autocommit is enabled. Defaults toTrue.autocommit_interval(int): The time in milliseconds between automatic commits ifautocommitisTrue. Defaults to250.lang_cache_size(int): The capacity of the language model cache. Defaults to1000.
Raises
Exception: Throws an exception if called after thedbzeroinstance has been closed withdbzero.close().
Example
import dbzero as db0
import os
import shutil
DB0_DIR = "/tmp/db0_docs_example"
# Clean up previous runs
if os.path.exists(DB0_DIR):
shutil.rmtree(DB0_DIR)
os.mkdir(DB0_DIR)
# Initialize with some custom settings
db0.init(DB0_DIR, config={'autocommit': False, 'autocommit_interval': 1000})
# Get the current configuration
config = db0.get_config()
print(config)
# Expected output:
# {'autocommit': False, 'autocommit_interval': 1000, 'lang_cache_size': 1000}
# Close the dbzero instance
db0.close()
# Calling get_config() now would raise an Exception
# config = db0.get_config() # -> raises Exception