Giter Site home page Giter Site logo

pombredanne / django-jsonfallback Goto Github PK

View Code? Open in Web Editor NEW

This project forked from raphaelm/django-jsonfallback

0.0 1.0 0.0 48 KB

Use PostgreSQL's and MySQL's JSONField, but fall back to a TextField implementation on other databases

License: Apache License 2.0

Python 96.56% Shell 3.44%

django-jsonfallback's Introduction

JSONField with fallback for Django

https://travis-ci.com/raphaelm/django-jsonfallback.svg?branch=master

This is an extension to django.contrib.postgres.fields.JSONField, that works on other databases than PostgreSQL.

  • On MySQL and MariaDB, it uses the native JSON data type and supports most features.
  • On SQLite and all other databases, it just stores JSON strings in a text field and does not support querying.

This is tested against:

  • Python 3.4 to 3.7
  • Django 2.0 to 2.2
  • MySQL 5.7 (only on Django 2.1+)
  • MariaDB 10.3
  • PostgreSQL 9.4
  • SQLite (no querying funcationality)

Usage

Just use our drop-in replacement for JSONField:

from django.db import models
from jsonfallback.fields import FallbackJSONField


class Book(models.Model):
    data = FallbackJSONField()

    def __str__(self):
        return str(self.data['title'])

License

The code in this repository is published under the terms of the Apache License. See the LICENSE file for the complete license text.

This project is maintained by Raphael Michel <[email protected]>. See the AUTHORS file for a list of all the awesome folks who contributed to this project.

django-jsonfallback's People

Contributors

laymonage avatar raphaelm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.