Merge branch 'master' of github.com:kvesteri/sqlalchemy-utils

This commit is contained in:
Konsta Vesterinen
2015-06-09 11:16:20 +03:00
4 changed files with 10 additions and 10 deletions

View File

@@ -14,9 +14,9 @@ Resources
- `Issue Tracker <http://github.com/kvesteri/sqlalchemy-utils/issues>`_
- `Code <http://github.com/kvesteri/sqlalchemy-utils/>`_
.. |Build Status| image:: https://travis-ci.org/kvesteri/sqlalchemy-utils.png?branch=master
.. |Build Status| image:: https://travis-ci.org/kvesteri/sqlalchemy-utils.svg?branch=master
:target: https://travis-ci.org/kvesteri/sqlalchemy-utils
.. |Version Status| image:: https://pypip.in/v/SQLAlchemy-Utils/badge.png
.. |Version Status| image:: https://img.shields.io/pypi/v/SQLAlchemy-Utils.svg
:target: https://pypi.python.org/pypi/SQLAlchemy-Utils/
.. |Downloads| image:: https://pypip.in/d/SQLAlchemy-Utils/badge.png
.. |Downloads| image:: https://img.shields.io/pypi/dm/SQLAlchemy-Utils.svg
:target: https://pypi.python.org/pypi/SQLAlchemy-Utils/

View File

@@ -38,7 +38,7 @@ extras_require = {
'pymysql',
'flake8>=2.4.0',
'isort==3.9.6',
'natsort==4.0.1',
'natsort==3.5.6',
],
'anyjson': ['anyjson>=0.3.3'],
'babel': ['Babel>=1.3'],

View File

@@ -1,5 +1,5 @@
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import array, ARRAY, JSON
from sqlalchemy.dialects import postgresql
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.expression import (
_literal_as_text,
@@ -94,7 +94,7 @@ def compile_array_get(element, compiler, **kw):
class row_to_json(GenericFunction):
name = 'row_to_json'
type = JSON
type = postgresql.JSON
@compiles(row_to_json, 'postgresql')
@@ -114,10 +114,10 @@ def compile_json_array_length(element, compiler, **kw):
class array_agg(GenericFunction):
name = 'array_agg'
type = ARRAY
type = postgresql.ARRAY
def __init__(self, arg, default=None, **kw):
self.type = ARRAY(arg.type)
self.type = postgresql.ARRAY(arg.type)
self.default = default
GenericFunction.__init__(self, arg, **kw)
@@ -129,7 +129,7 @@ def compile_array_agg(element, compiler, **kw):
return compiled
return str(sa.func.coalesce(
sa.text(compiled),
sa.cast(array(element.default), element.type)
sa.cast(postgresql.array(element.default), element.type)
).compile(compiler))

View File

@@ -129,7 +129,7 @@ class ChoiceType(types.TypeDecorator, ScalarCoercible):
__tablename__ = 'user'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.Unicode(255))
type = sa.Column(ChoiceType(TYPES))
type = sa.Column(ChoiceType(UserType, impl=sa.Integer()))
user = User(type=UserType.admin)