https://github.com/teohrt/neo4j-poc
https://github.com/teohrt/neo4j-poc
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/teohrt/neo4j-poc
- Owner: teohrt
- Created: 2024-02-07T01:36:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T01:38:52.000Z (over 2 years ago)
- Last Synced: 2024-12-27T17:35:05.599Z (over 1 year ago)
- Language: Python
- Size: 585 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Neo4j PoC
## Running Locally
1. [Install Neo4J Desktop GUI ](https://neo4j.com/product/developer-tools/)
* Allows you to connect to our locally running docker container
* Has really nice tutorials for how to interact with the graph, and provides thorough examples
* 
2. Download neo4j image
```bash
docker pull neo4j
```
3. Run db container
```bash
docker run \
--env NEO4J_AUTH=neo4j/newPassword \
--publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
neo4j
```
4. Initialize virtual environment
```bash
python -m venv .venv
. .venv/bin/activate
```
5. Install dependencies
```bash
pip install -r requirements.txt
```
6. Run hello world example
```bash
python hello_world.py
```
* 
7. Seed db
```bash
python models_example.py
```
* 
## Notes
### Object Graph Mapper (It's OGM rather than ORM)
[Neomodel](https://neo4j.com/labs/neomodel/) is an OGM for Python and Neo4j. It allows you to define your graph database model in a Pythonic way and then access and edit your data **without needing to write Cypher queries**.
You can inspect an existing Neo4j database to generate a neomodel definition file using the inspect command:
```bash
neomodel_inspect_database -db bolt://neo4j:neo4j@localhost:7687 --write-to yourapp/models.py
```
### Django considerations
There is a Django specific Neomodel OGM plugin https://pypi.org/project/django-neomodel/
* This is in beta
* It should be noted that AWS' Neptune doesn't have anything similar though
Model form example pulled from [docs](https://pypi.org/project/django-neomodel/):
