A simple graph database in SQLite
Project description
About
This is the PyPI package of the simple-graph implementation in Python, which is a simple graph database in SQLite, inspired by "SQLite as a document database".
Build and Test
How to generate the distribution archive and confirm it on test.pypi.org, also based on the pypa/sampleproject:
rm -rf build dist src/simple_graph_sqlite.egg-info
python -m build
python -m twine upload --repository testpypi dist/*
Create a virtual environment for the test package, activate it, pull from test.pypi.org (the --extra-index-url
is necessary since the graphviz
dependency may not be in the test archive), and confirm the package is available:
$ pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple simple-graph-sqlite graphviz==0.16
$ python
Python 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from simple_graph_sqlite import database as db
With the test package installed, run pytest
from the root of this repository. If the tests pass, rebuild and push to pypi.org:
rm -rf build dist src/simple_graph_sqlite.egg-info
python -m build
python -m twine upload --repository pypi dist/*
Structure
The schema consists of just two structures:
- Nodes - these are any json objects, with the only constraint being that they each contain a unique
id
value - Edges - these are pairs of node
id
values, specifying the direction, with an optional json object as connection properties
There are also traversal functions as native SQLite Common Table Expressions:
Applications
- Social networks
- Interest maps/recommendation finders
- To-do / task lists
- Bug trackers
- Customer relationship management (CRM)
- Gantt chart
Usage
Installation Requirements
- SQLite, version 3.31.0 or higher; get the latest source or precompiled binaries from the SQLite Download Page
- Graphviz for visualization (download page, installation procedure for Windows)
Basic Functions
The database script provides convenience functions for atomic transactions to add, delete, connect, and search for nodes.
Any single node or path of nodes can also be depicted graphically by using the visualize
function within the database script to generate dot files, which in turn can be converted to images with Graphviz.
See the documented example or the unit tests for more.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for simple-graph-sqlite-2.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19d7170070608eed6a044f2d4ac95cdaa109336c67df944fa8452ee318ad6202 |
|
MD5 | d33b5a4a9df7a8076bdd87bfe2a2948a |
|
BLAKE2b-256 | 68b13869dc88ea1a4137f3972316032586a34a40effe3bbd4274478ff5620c9e |
Hashes for simple_graph_sqlite-2.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8200c80b79302687cea81d1d768ad63223398e46b935ab34c1c80b1ba121a7d6 |
|
MD5 | 464418479f92abc92f119eb78909356b |
|
BLAKE2b-256 | 865b92a0212c65bdd6e6923150850b9d363d2e991e9e222dfa8a8f5b274f0216 |