Skip to main content

My Network Query Language

Project description


MyNLQ’s source code hosted on GitHub.

git clone
python install

or just

pip install MyNQL

Teach the Network

For example if a customer make a purchase of a product you assume a relation between and, so you connect them. Optional you can specify a distance between nodes, to represent how close the nodes are related.

  • connect - connect two nodes

  • delete - delete a connection

Nodes are created automatically when you do the connection, and removed if they do not have any more connections. So do not worry about them.

Ask the Network

Now you can query all kinds of relations, not only the once you taught. With select you specify a starting point, like and specify the category where you like to know its closes relation.

  • select - gives you the best related nodes from a specified category

The searching query takes into account all the different routes up to a radius you specify.


Lets imagine we already have a table customer









and you want to teach the network about recent purchases.

from MyNQL import MyNQL
mynql = MyNQL('store')

mynql.connect('customer.juan', 'product.jeans')
mynql.connect('customer.juan',  'product.socks')
mynql.connect('customer.maria', 'product.socks')

If the column Name is unique you can use it as a key, otherwise you would need column Id, and your code would look like this:

mynql.connect("customer.103', 'product.12')

Now you can ask questions from other points of view. You always specify a starting point, and the category where you want to know the best matches:

>>>'customer.maria', 'product')
['socks', 'jeans']

Maria is more connected to socks, as she has a direct connection, but also a bit to jeans as there exist an indirect connection through Juan.

>>>'product.jeans', 'product')

Any combination is valid. For example you can ask about how one product is related to other.


Storage is done in memory, but if you want to use MySQL, SQLite or PostgreSQL as a backend take a look at test/ This will keep a copy of all updates in your database.

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

MyNQL-0.2.1.tar.gz (7.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page