From cb0b59ba8cbbd2777509670ac887fb15f4e26cac Mon Sep 17 00:00:00 2001 From: Konsta Vesterinen Date: Thu, 24 Oct 2013 17:40:51 +0300 Subject: [PATCH] Added docs for JSONType, bumped version --- CHANGES.rst | 6 ++++++ docs/index.rst | 27 +++++++++++++++++++++++++++ sqlalchemy_utils/__init__.py | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index d494a61..a9687a0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,12 @@ Changelog Here you can see the full list of changes between each SQLAlchemy-Utils release. +0.20.0 (2013-10-24) +^^^^^^^^^^^^^^^^^^^ + +- Added JSONType + + 0.19.0 (2013-10-24) ^^^^^^^^^^^^^^^^^^^ diff --git a/docs/index.rst b/docs/index.rst index bd465e5..75d4dc2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -144,6 +144,33 @@ Querying the database returns Color objects: For more information about colour package and Color object, see https://github.com/vaab/colour +JSONType +^^^^^^^^ + +JSONType offers way of saving JSON data structures to database. On PostgreSQL the underlying implementation of this data type is 'json' while on other databases its simply 'text'. + +:: + + + from sqlalchemy_utils import JSONType + + + class Product(Base): + __tablename__ = 'product' + id = sa.Column(sa.Integer, autoincrement=True) + name = sa.Column(sa.Unicode(50)) + details = sa.Column(JSONType) + + + product = Product() + product.details = { + 'color': 'red', + 'type': 'car', + 'max-speed': '400 mph' + } + session.commit() + + LocaleType ^^^^^^^^^^ diff --git a/sqlalchemy_utils/__init__.py b/sqlalchemy_utils/__init__.py index 07df3fe..52c2af7 100644 --- a/sqlalchemy_utils/__init__.py +++ b/sqlalchemy_utils/__init__.py @@ -45,7 +45,7 @@ from .types import ( ) -__version__ = '0.19.0' +__version__ = '0.20.0' __all__ = (