update to sqlalchemy 1

This commit is contained in:
j 2016-02-22 18:00:55 +05:30
parent 0c0d87cadb
commit 649b0553b4
3 changed files with 7 additions and 5 deletions

View file

@ -24,6 +24,7 @@ def parse(data):
return query
def order(qs, sort, prefix='sort.'):
from sqlalchemy.sql.expression import text
order_by = []
if len(sort) == 1:
additional_sort = settings.config['user']['ui']['listSort']
@ -48,8 +49,8 @@ def order(qs, sort, prefix='sort.'):
_order_by = []
for order in order_by:
nulls = "%s IS NULL" % order.split(' ')[0]
_order_by.append(nulls)
_order_by.append(order)
_order_by.append(text(nulls))
_order_by.append(text(order))
order_by = _order_by
qs = qs.join(models.Sort).order_by(*order_by)
return qs

View file

@ -5,6 +5,7 @@ from datetime import datetime
import unicodedata
from sqlalchemy.sql import operators
from sqlalchemy.orm import load_only
from sqlalchemy.sql.expression import text
import utils
import settings
@ -134,7 +135,7 @@ class Parser(object):
ids = self._user_items.select().where(
self._user_items.columns['user_id'].is_(u.id)
).with_only_columns(
['item_id']
[text('item_id')]
)
elif nickname:
peer = utils.get_peer(u.id)
@ -145,7 +146,7 @@ class Parser(object):
ids = self._list_items.select().where(
self._list_items.columns['list_id'].is_(l.id)
).with_only_columns(
['item_id']
[text('item_id')]
)
else:
ids = l.get_items().options(load_only('id'))

View file

@ -1,7 +1,7 @@
lxml
simplejson
ed25519>=1.4
SQLAlchemy==0.9.7
SQLAlchemy==1.0.12
pyopenssl>=0.15
pyCrypto>=2.6.1
pillow