Escape table name in queries

master
0xee 2020-12-13 19:26:38 +01:00
parent 98061e95c3
commit 6215406e34
1 changed files with 1 additions and 1 deletions

2
tsplot
View File

@ -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')