Skip to main content

Search MySQL JSON fields in Django

Project description


Searching in MySQL JSON field in Django


MySQL has introduced JSON fields in MySQL Server 5.7, Currently it works well with jsonfield for Data Saving and retrieval. The problem that Searching can only be done through LIKE operator which isn't convinent for all function.


Creating a new custom lookup operator "has" for Django that will support JSON Search in MySQL.


Install the Package

$ pip install jsonLookup

Register to JSONFields

from jsonLookup import hasLookup,jcontainsLookup

Write your JSON queries

# Create test objects
# Run first query
q = User.objects.filter(properties__has="$.city=Giza")
print q[0].name
# Run Second query
q= User.objects.filter(properties__has="$.Address.Code=11351")
print q[0].name

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jsonLookup, version 0.7.5
Filename, size File type Python version Upload date Hashes
Filename, size jsonLookup-0.7.5.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page