Skip to content

Don't register berkelydb as a store if it is not available on the system #1816

@aucampia

Description

@aucampia

Currently we are always registering BerkelyDB regardless of whether it is available or not:

rdflib/rdflib/plugin.py

Lines 202 to 207 in cdaee27

register(
"BerkeleyDB",
Store,
"rdflib.plugins.stores.berkeleydb",
"BerkeleyDB",
)

This causes problems if we want to operate on all stores, for example to test some functionality, as a special exception is needed for BerkeleyDB:

def get_store_names() -> Set[Optional[str]]:
names: Set[Optional[str]] = {*get_unique_plugin_names(plugin.Store)}
names.difference_update({
"default",
"Memory",
"Auditable",
"Concurrent",
"SPARQLStore",
"SPARQLUpdateStore",
"SimpleMemory",
})
names.add(None)
if not has_bsddb:
names.remove("BerkeleyDB")
logging.debug("names = %s", names)
return names

I think it would be best to only register the plugin if the store is available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersstoreRelated to a store.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions