From 6215406e34ba18073c6c8bd70edf8414bbf1f877 Mon Sep 17 00:00:00 2001 From: 0xee Date: Sun, 13 Dec 2020 19:26:38 +0100 Subject: [PATCH] Escape table name in queries --- tsplot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsplot b/tsplot index 70392e7..f56b2b6 100755 --- a/tsplot +++ b/tsplot @@ -48,7 +48,7 @@ def get_data(topic, timerange, ts): table = topic earliest = datetime.datetime.now() - timerange - query = f"SELECT * FROM {table} WHERE timestamp > '{earliest}'" + query = f"SELECT * FROM \"{table}\" WHERE timestamp > '{earliest}'" df = pd.read_sql(query, conn, parse_dates=[ 'timestamp'], index_col='timestamp')