From 6a9884ee5b64464eb7f4cd146becbdbab1a1e959 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 12 Aug 2024 13:41:31 +1000 Subject: [PATCH] sheetsync: Move extra metrics columns into a variable --- sheetsync/sheetsync/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sheetsync/sheetsync/main.py b/sheetsync/sheetsync/main.py index 269a577..d086ed2 100644 --- a/sheetsync/sheetsync/main.py +++ b/sheetsync/sheetsync/main.py @@ -95,6 +95,16 @@ class SheetSync(object): 'state', 'error', } + # Additional columns to read from the database but not write to the sheet, + # for metrics purposes. + metrics_columns = { + "state", + "error", + "public", + "poster_moment", + "sheet_name", + "category", + } def __init__(self, name, middleware, stop, dbmanager, reverse_sync=False): self.name = name @@ -159,9 +169,10 @@ class SheetSync(object): SELECT {} FROM {} """).format( sql.SQL(", ").join(sql.Identifier(col) for col in - { "id", "state", "error", "public", "poster_moment", "sheet_name", "category" } + {"id"} | self.input_columns | self.output_columns + | self.metrics_columns ), sql.Identifier("table"), )