Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aplbrain/tamarind
manage multiple ephemeral neo4j containers
https://github.com/aplbrain/tamarind
database docker graph graph-database neo4j neo4j-database
Last synced: 3 months ago
JSON representation
manage multiple ephemeral neo4j containers
- Host: GitHub
- URL: https://github.com/aplbrain/tamarind
- Owner: aplbrain
- License: apache-2.0
- Created: 2019-03-26T00:19:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-20T10:04:58.000Z (5 months ago)
- Last Synced: 2024-10-05T18:36:24.600Z (3 months ago)
- Topics: database, docker, graph, graph-database, neo4j, neo4j-database
- Language: Python
- Homepage:
- Size: 63.5 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
tamarind
ðŸ¥
manage multiple ephemeral neo4j containers
`tamarind` is a system that manages Neo4j databases by provisioning Docker container resources for you. The user-facing API provides access to a dictionary-like lookup for your databases, and allows you to start and stop database servers on the fly.
## Installation
Install from PyPI using pip:
```shell
pip3 install tamarind
```You will need Docker already installed if you intend to use the Docker provisioning service. You can install Docker with the script from `https://get.docker.com/`.
## Usage
### Creating a new db
```python
from tamarind import Neo4jDockerProvisionerN = Neo4jDockerProvisioner()
N.start("MyDatabase")
```Now you can access this graph database through py2neo:
```python
>>> N["MyDatabase"]```
The object returned is a [`py2neo.database.Graph`](https://py2neo.org/v4/database.html#py2neo.database.Graph) object:
```python
>>> N["MyDatabase"].run("MATCH (a:Person) RETURN a.name, a.born LIMIT 4").data()
[{'a.born': 1964, 'a.name': 'Keanu Reeves'},
{'a.born': 1967, 'a.name': 'Carrie-Anne Moss'},
{'a.born': 1961, 'a.name': 'Laurence Fishburne'},
{'a.born': 1960, 'a.name': 'Hugo Weaving'}]```
### List all
```python
>>> N.ps().keys()
['MyDatabase', 'OldDatabase']
```### Stop a service
```python
>>> N.stop("OldDatabase")
>>> N.ps().keys()
['MyDatabase']
```## Custom Provisioners
If you provision Neo4j instances via resources other than Docker (e.g. via AWS EC2 AMIs), you can extend the `Neo4jProvisioner` class with `start` and `ps` function calls (`stop` is an optional implementation in Tamarind).
## Legal
Licensed under Apache 2.0.
> Copyright 2024 Johns Hopkins University Applied Physics Laboratory
>
> Licensed under the Apache License, Version 2.0 (the "License");
> you may not use this codebase except in compliance with the License.
> You may obtain a copy of the License at
>
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing, software
> distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the License for the specific language governing permissions and
> limitations under the License.