|
|
@ -214,11 +214,11 @@ class SheetSync(object):
|
|
|
|
sql.SQL(", ").join(sql.Placeholder(col) for col in insert_cols),
|
|
|
|
sql.SQL(", ").join(sql.Placeholder(col) for col in insert_cols),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
query(self.conn, built_query, sheet_name=worksheet, **row)
|
|
|
|
query(self.conn, built_query, sheet_name=worksheet, **row)
|
|
|
|
rows_found(worksheet).inc()
|
|
|
|
rows_found.labels(worksheet).inc()
|
|
|
|
rows_changed('insert', worksheet).inc()
|
|
|
|
rows_changed.labels('insert', worksheet).inc()
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
rows_found(worksheet).inc()
|
|
|
|
rows_found.labels(worksheet).inc()
|
|
|
|
|
|
|
|
|
|
|
|
# Update database with any changed inputs
|
|
|
|
# Update database with any changed inputs
|
|
|
|
changed = [col for col in self.input_columns if row[col] != getattr(event, col)]
|
|
|
|
changed = [col for col in self.input_columns if row[col] != getattr(event, col)]
|
|
|
@ -236,7 +236,7 @@ class SheetSync(object):
|
|
|
|
) for col in changed
|
|
|
|
) for col in changed
|
|
|
|
))
|
|
|
|
))
|
|
|
|
query(self.conn, built_query, **row)
|
|
|
|
query(self.conn, built_query, **row)
|
|
|
|
rows_changed('input', worksheet).inc()
|
|
|
|
rows_changed.labels('input', worksheet).inc()
|
|
|
|
|
|
|
|
|
|
|
|
# Update sheet with any changed outputs
|
|
|
|
# Update sheet with any changed outputs
|
|
|
|
format_output = lambda v: '' if v is None else v # cast nulls to empty string
|
|
|
|
format_output = lambda v: '' if v is None else v # cast nulls to empty string
|
|
|
@ -251,7 +251,7 @@ class SheetSync(object):
|
|
|
|
row_index, self.column_map[col],
|
|
|
|
row_index, self.column_map[col],
|
|
|
|
format_output(getattr(event, col)),
|
|
|
|
format_output(getattr(event, col)),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
rows_changed('output', worksheet).inc()
|
|
|
|
rows_changed.labels('output', worksheet).inc()
|
|
|
|
|
|
|
|
|
|
|
|
# Set edit link if marked for editing and start/end set.
|
|
|
|
# Set edit link if marked for editing and start/end set.
|
|
|
|
# This prevents accidents / clicking the wrong row and provides
|
|
|
|
# This prevents accidents / clicking the wrong row and provides
|
|
|
|