Skip to content

Commit

Permalink
Use same style for getting data from cursor in data fetcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
iljah committed Apr 26, 2023
1 parent 9a02567 commit b791c11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
for station in new_data.keys():
for dt in new_data[station].keys():
cursor.execute('select exists (select from ' + args.table + ' where datetime = %s and station = %s)', (dt, station))
result = cursor.fetchone()
if not result[0]:
result = cursor.fetchone()[0]
if not result:
cursor.execute('insert into ' + args.table + ' (datetime, station, value) values (%s, %s, %s)', (dt, station, new_data[station][dt]))
inserted += 1
connection.commit()
Expand Down

0 comments on commit b791c11

Please sign in to comment.