Indices¶
Open-source Python library for graph databases.
Index Container¶
- class bulbs.base.index.Index(client, result)[source]¶
Abstract base class for the default index.
Variables: - client – Client object
- result – Result object.
- classmethod get_proxy_class(base_type=None)[source]¶
Returns the IndexProxy class.
Parameters: base_type (str) – Index base type, either vertex or edge. Return type: class
- put(_id, key=None, value=None, **pair)[source]¶
Put an element into the index at key/value and return the Response.
Parameters: - _id (int or str) – The element ID.
- key (str) – The index key.
- value (str or int) – The key’s value.
- pair (name/value pair) – Optional key/value pair. Example: name=”James”
Return type: Response
- update(_id, key=None, value=None, **pair)[source]¶
Update the element ID for the key and value.
Parameters: - key (str) – The index key.
- value (str or int) – The key’s value.
- pair (key/value pair) – Optional key/value pair. Example: name=”James”
Return type: Response
- lookup(key=None, value=None, **pair)[source]¶
Return all the elements in the index where key equals value.
Parameters: - key (str) – The index key.
- value (str or int) – The key’s value.
- pair (key/value pair) – Optional key/value pair. Example: name=”James”
Return type: Element generator
- put_unique(_id, key=None, value=None, **pair)[source]¶
Put an element into the index at key/value and overwrite it if an element already exists; thus, when you do a lookup on that key/value pair, there will be a max of 1 element returned.
Parameters: - key (str) – The index key.
- value (str or int) – The key’s value.
- pair (key/value pair) – Optional key/value pair. Example: name=”James”
Return type: Resposne
- get_unique(key=None, value=None, **pair)[source]¶
Returns a max of 1 elements in the index matching the key/value pair.
Parameters: - key (str) – The index key.
- value (str or int) – The key’s value.
- pair (key/value pair) – Optional key/value pair. Example: name=”James”
Return type: Element or None
Index Proxies¶
- class bulbs.base.index.VertexIndexProxy(index_class, client)[source]¶
Abstract base class the vertex index proxy.
Variables: - index_class – Index class.
- client – Client object.
- create(index_name)[source]¶
Creates an Vertex index and returns it.
Parameters: index_name (str) – Index name. Return type: Index
- get(index_name)[source]¶
Returns the Index object with the specified name or None if not found.
Parameters: index_name (str) – Index name. Return type: Index
- class bulbs.base.index.EdgeIndexProxy(index_class, client)[source]¶
Abstract base class the edge index proxy.
Variables: - index_class – Index class.
- client – Client object.
- create(index_name)[source]¶
Creates an Edge index and returns it.
Parameters: index_name (str) – Index name. Return type: Index
- get(index_name)[source]¶
Returns the Index object with the specified name or None if not found.
Parameters: index_name (str) – Index name. Return type: Index