Skip to main content

Django extension for efficient and easy storing dict data in django field.

Project description

django-dict-field

PyPI version Python Version PyPI license test typing & lint

⚠️ This project under active developing.

Django extension for storing dict data in relation database field with fast performance and flex schema.

📍 Purpose

Sometimes we need to store some key value data in storages. Often it also need to be efficient for work with big data and have some validation and another features.

django-dict-field is a tool build around amazing msgspec serialization and validation library for solving this problems like a charm ✨

DictField vs JSONField Benchmark

Operations on 100 000 size dict on PostgreSQL DB. Script here.

DictField vs JSONField Benchmark

🚀 Quick start

  1. Install django-dict-field.
pip install django-dict-field
  1. Add DictField to your model.
from django.db.models import Model, CharField, DateTimeField
from django_dict_field import DictField

class Car(Model):
    model = CharField()
    creation_data = DateTimeField()
    configuration = DictField()  # for storing a lot of configuration settings
  1. Work with it!
# create
car = Car.objects.create(
    model="Toyota Camry",
    creation_data=datetime(2021, 3, 15),
    configuration={
        "capacity": 2.5,
        "drive": "FWD",
        "consumption": 6.8,
    }
)

# read
assert car.configuration["drive"] == "FWD"

# update
car.configuration["capacity"] = 2.8

# delete
del car.configuration["doors"]

🤗 Author

Made with love by @skv0zsneg

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

django_dict_field-0.1.0a1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

django_dict_field-0.1.0a1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file django_dict_field-0.1.0a1.tar.gz.

File metadata

  • Download URL: django_dict_field-0.1.0a1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.0 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for django_dict_field-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 f5561dec7c35c68ece9e2bed5d2a3de7d0d5fb699c3541050533334ef6d27bb5
MD5 32365873c328154a961397effe7c4c4e
BLAKE2b-256 b23b80c81c385e1d1ac49dd1311a3bd51db4daf4c6ec39027d7431004eb8f64e

See more details on using hashes here.

File details

Details for the file django_dict_field-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: django_dict_field-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.0 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for django_dict_field-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 abc943138b45c63f677ad66d78293376850b7a82d5193aeef9a2a28dd2c1dc73
MD5 e06c69d529b7b1ac1800bfbe3fd9db10
BLAKE2b-256 d91601dea662fe8513c5fef08d79389c57601a061b9a8dc8a7c3b04351873474

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