digicatapult / fornax

Approximate fuzzy subgraph matching in polynomial time
Apache License 2.0
21 stars 4 forks source link

Connection should take a mandatory database url #19

Closed Dan-Staff closed 5 years ago

Dan-Staff commented 5 years ago

This syntax is bad:

connection = fornax.Conection.open()

As it results in the following behaviour:

connection = fornax.Conection.open()
graph = fornax.GraphHandle.create(conn)
connection.close()

# exception raised here because graph no longer exists 
connection = fornax.Conection.open()
graph.fornax.GraphHandle.read(graph.graph_id)

By default fornax creates an in memory sqlite database but this will not persist between connections.

Solution

Force the user to be exploit about the database location:

fornax.GraphHandle.create('sqlite://')

or

fornax.GraphHandle.create('sqlite:///mydb.sqlite')