WIP: SQLA2: Fix connection.execute

Change-Id: I597eed6f24f13f96f78f6596e16b6edcff989a90
This commit is contained in:
Michal Nasiadka 2024-03-01 12:31:53 +01:00
parent 5a07a1ebc3
commit 179fbd1c3f
3 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ def upgrade():
connection = op.get_bind()
# Fetching all required info from existing cluster
res = connection.execute(
res = connection.execute(sa.text(
"SELECT "
"cluster.uuid, "
"cluster.name, "
@ -82,7 +82,7 @@ def upgrade():
"cluster_template.flavor_id, "
"cluster_template.image_id "
"FROM cluster INNER JOIN cluster_template "
"ON cluster.cluster_template_id=cluster_template.uuid"
"ON cluster.cluster_template_id=cluster_template.uuid")
)
results = res.fetchall()

View File

@ -33,11 +33,11 @@ def upgrade():
default=False))
# Populate existing cluster with the cluster template_id
connection = op.get_bind()
connection.execute(
connection.execute(sa.text(
"UPDATE cluster "
"INNER JOIN cluster_template "
"ON cluster_template.uuid=cluster.cluster_template_id "
"SET cluster.master_lb_enabled=cluster_template.master_lb_enabled "
"WHERE cluster_template.uuid=cluster.cluster_template_id and "
"cluster.master_lb_enabled is NULL"
"cluster.master_lb_enabled is NULL")
)

View File

@ -41,10 +41,10 @@ def upgrade():
# Populate existing nodegroups with the cluster stack_id
connection = op.get_bind()
connection.execute(
connection.execute(sa.text(
"UPDATE nodegroup "
"INNER JOIN cluster ON nodegroup.cluster_id=cluster.uuid "
"SET nodegroup.stack_id=cluster.stack_id, "
"nodegroup.status=cluster.status, nodegroup.version=0 "
"WHERE nodegroup.cluster_id=cluster.uuid"
"WHERE nodegroup.cluster_id=cluster.uuid")
)