Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bailliekova committed Oct 15, 2024
1 parent 5a27fa8 commit 2d6df9f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions gerrydb_meta/crud/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,20 @@ def set_values(
# Add the new column values and invalidate the old ones where present.
geo_ids = [geo.geo_id for geo, _ in values]
with_tuples = (
db.query(models.ColumnValue.col_id,models.ColumnValue.geo_id,models.ColumnValue.valid_from)
db.query(
models.ColumnValue.col_id,
models.ColumnValue.geo_id,
models.ColumnValue.valid_from,
)
.filter(
models.ColumnValue.col_id == col.col_id,
models.ColumnValue.geo_id.in_(geo_ids),
models.ColumnValue.valid_to.is_(None),
)
.all()
)
with_values=["_".join([str(val) for val in tup]) for tup in with_tuples]

with_values = ["_".join([str(val) for val in tup]) for tup in with_tuples]

with db.begin(nested=True):
db.execute(insert(models.ColumnValue), rows)
Expand All @@ -222,8 +226,14 @@ def set_values(
db.execute(
update(models.ColumnValue)
.where(
"_".join([str(models.ColumnValue.col_id), str(models.ColumnValue.geo_id), str(models.ColumnValue.valid_from)])
in with_values
"_".join(
[
str(models.ColumnValue.col_id),
str(models.ColumnValue.geo_id),
str(models.ColumnValue.valid_from),
]
)
in with_values
)
.values(valid_to=now)
)
Expand Down

0 comments on commit 2d6df9f

Please sign in to comment.