Skip to content

Commit ba75dce

Browse files
committed
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
1 parent b2e20a1 commit ba75dce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

magnum/db/sqlalchemy/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def get_cluster_template_by_id(self, context, cluster_template_id):
344344
query = self._add_tenant_filters(context, query)
345345
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
346346
query = query.union(public_q)
347-
query = query.filter_by(cluster_template_id=cluster_template_id)
347+
query = query.filter(models.ClusterTemplate.id==cluster_template_id)
348348
try:
349349
return query.one()
350350
except NoResultFound:
@@ -356,7 +356,7 @@ def get_cluster_template_by_uuid(self, context, cluster_template_uuid):
356356
query = self._add_tenant_filters(context, query)
357357
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
358358
query = query.union(public_q)
359-
query = query.filter_by(cluster_template_uuid=cluster_template_uuid)
359+
query = query.filter(models.ClusterTemplate.uuid==cluster_template_uuid)
360360
try:
361361
return query.one()
362362
except NoResultFound:
@@ -368,7 +368,7 @@ def get_cluster_template_by_name(self, context, cluster_template_name):
368368
query = self._add_tenant_filters(context, query)
369369
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
370370
query = query.union(public_q)
371-
query = query.filter_by(cluster_template_name=cluster_template_name)
371+
query = query.filter(models.ClusterTemplate.name==cluster_template_name)
372372
try:
373373
return query.one()
374374
except MultipleResultsFound:

0 commit comments

Comments
 (0)