Make DB queries compatible with SQLAlchemy 1.4.x
Change-Id: I25eae9e6de8534b40493caf23cc49602a44efd26 Closes-Bug: #1930908
This commit is contained in:
parent
63ef8f81f3
commit
2f8625efbd
|
@ -119,6 +119,10 @@ ModelBase.__init__ = initialize_decorator(ModelBase.__init__)
|
||||||
class JsonBlob(sql_types.TypeDecorator):
|
class JsonBlob(sql_types.TypeDecorator):
|
||||||
|
|
||||||
impl = sql.Text
|
impl = sql.Text
|
||||||
|
# NOTE(ralonsoh): set to True as any other TypeDecorator in SQLAlchemy
|
||||||
|
# https://docs.sqlalchemy.org/en/14/core/custom_types.html# \
|
||||||
|
# sqlalchemy.types.TypeDecorator.cache_ok
|
||||||
|
cache_ok = True
|
||||||
|
|
||||||
def process_bind_param(self, value, dialect):
|
def process_bind_param(self, value, dialect):
|
||||||
return jsonutils.dumps(value)
|
return jsonutils.dumps(value)
|
||||||
|
@ -144,6 +148,10 @@ class DateTimeInt(sql_types.TypeDecorator):
|
||||||
|
|
||||||
impl = sql.BigInteger
|
impl = sql.BigInteger
|
||||||
epoch = datetime.datetime.fromtimestamp(0, tz=pytz.UTC)
|
epoch = datetime.datetime.fromtimestamp(0, tz=pytz.UTC)
|
||||||
|
# NOTE(ralonsoh): set to True as any other TypeDecorator in SQLAlchemy
|
||||||
|
# https://docs.sqlalchemy.org/en/14/core/custom_types.html# \
|
||||||
|
# sqlalchemy.types.TypeDecorator.cache_ok
|
||||||
|
cache_ok = True
|
||||||
|
|
||||||
def process_bind_param(self, value, dialect):
|
def process_bind_param(self, value, dialect):
|
||||||
if value is None:
|
if value is None:
|
||||||
|
|
|
@ -98,7 +98,8 @@ class ShadowUsers(base.ShadowUsersDriverBase):
|
||||||
x for x in hints.filters if x['name'] not in ('idp_id',
|
x for x in hints.filters if x['name'] not in ('idp_id',
|
||||||
'protocol_id',
|
'protocol_id',
|
||||||
'unique_id')]
|
'unique_id')]
|
||||||
query = query.filter(sqlalchemy.and_(*statements))
|
if statements:
|
||||||
|
query = query.filter(sqlalchemy.and_(*statements))
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def get_federated_users(self, hints):
|
def get_federated_users(self, hints):
|
||||||
|
|
Loading…
Reference in New Issue