Ensure backward compatibility with SQLAlchemy<1.4

In Ib6e3ed40dc8b075c3cecb967b7417097e3cab60d, a breaking change was
introduced to suppose SQLAlchemy 1.4.x but this PS ensures backward
compatibility with 1.3.x.

Change-Id: I73ef4f99f02abc8b1083860f34a8a8e084ad96fd
This commit is contained in:
Bharat Kunwar 2021-06-29 15:38:39 +00:00
parent b2e20a1143
commit ba75dce28a
1 changed files with 3 additions and 3 deletions

View File

@ -344,7 +344,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(cluster_template_id=cluster_template_id)
query = query.filter(models.ClusterTemplate.id==cluster_template_id)
try:
return query.one()
except NoResultFound:
@ -356,7 +356,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(cluster_template_uuid=cluster_template_uuid)
query = query.filter(models.ClusterTemplate.uuid==cluster_template_uuid)
try:
return query.one()
except NoResultFound:
@ -368,7 +368,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(cluster_template_name=cluster_template_name)
query = query.filter(models.ClusterTemplate.name==cluster_template_name)
try:
return query.one()
except MultipleResultsFound: