Skip to content

Suggestion: use driver context manager #2

@robsdedude

Description

@robsdedude

All examples use something like

driver = GraphDatabase.driver(...)

...  # some work

driver.close()

I advise to use the following instead.

with GraphDatabase.driver(...) as driver:
    ...  # some work

This way, the driver will always get closed properly even if "some work" results in an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions