Added docs for JSONType, bumped version
This commit is contained in:
@@ -4,6 +4,12 @@ Changelog
|
|||||||
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
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)
|
0.19.0 (2013-10-24)
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@@ -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
|
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
|
LocaleType
|
||||||
^^^^^^^^^^
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ from .types import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.19.0'
|
__version__ = '0.20.0'
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
Reference in New Issue
Block a user