Admin Tools¶
Administration utilities for managing a neuprint server. Using these tools requires admin privileges on the neuPrintHttp server.
- class neuprint.admin.Transaction(dataset, *, client=None)[source]¶
For admins only. Used to batch a set of operations into a single database transaction.
This class is implemented as a context manager.
Example
with Transaction('hemibrain') as t: t.query("MATCH (n :Neuron {bodyId: 1047426385}) SET m.type=TuBu4)")
Transaction constructor.
- Parameters:
dataset – Name of the dataset to use. Required.
client – Client object to use.
- query(cypher, format='pandas')[source]¶
Make a custom cypher query within the context of this transaction (allows writes).
If writing JSON to a property, be sure to escape single or double quotes, depending on which quote character you use when expressing the string in Cypher.
Example:
import json from neuprint.admin import Transaction myprop = {"foo": "bar"} myprop = json.dumps(myprop).replace("\", "\\").replace("'", "\'") q = f''' MATCH (m:Meta) SET m.myproperty = '{myprop}' ''' with Transaction('my-dataset', client=c) as t: t.query(q)