Skip to main content

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 the generate distribution archive and confirm it on test.pypi.org:

rm dist/*
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 dist/*
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

Usage

Installation Requirements

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

simple-graph-sqlite-2.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_graph_sqlite-2.0.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file simple-graph-sqlite-2.0.1.tar.gz.

File metadata

  • Download URL: simple-graph-sqlite-2.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for simple-graph-sqlite-2.0.1.tar.gz
Algorithm Hash digest
SHA256 09beeaff9684752ce9261bde2db8fe0c84c88c0261ffae522ba4a7ef8fec9bec
MD5 1721ec3dd2f82deabb8a6ab1fedc5e7d
BLAKE2b-256 63c90d6d5d1ec66ada46ac4ec2624ef2262b65144f12c4903d53d37d904dc3f9

See more details on using hashes here.

File details

Details for the file simple_graph_sqlite-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: simple_graph_sqlite-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for simple_graph_sqlite-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b58e9f46a3c3f76568ebcbc52e77b243e66f0e2652244dde0d915be1fba9f058
MD5 58858668f27a6640b09e29c93e691b7d
BLAKE2b-256 590252ddd4408030810e53f47de56a17e73a9abf30546b8d1588f292061fefaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page