Skip to content

Commit

Permalink
Save on commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
solresol committed Jan 17, 2024
1 parent 1dd5b67 commit 8315b04
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions exporter.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ def write_sqlite(conn, weather_data, astronomy_data):
conn.commit()
cursor.execute("DELETE FROM astronomy")
conn.commit()
for record in weather_data:
for i, record in enumerate(weather_data):
cursor.execute("INSERT INTO weather (when_recorded, clouds) VALUES (?, ?)", record)
conn.commit()
for record in astronomy_data:
if i % 1000 == 0:
conn.commit()
for i, record in enumerate(astronomy_data):
cursor.execute("INSERT INTO astronomy (when_recorded_rounded, watts, moon_azimuth, moon_altitude, moon_phase, sun_azimuth, sun_altitude) VALUES (?, ?, ?, ?, ?, ?, ?)", record)
conn.commit()
if i % 1000 == 0:
conn.commit()
conn.commit()

def check_config_file_exists(config_file):
if not os.path.isfile(config_file):
Expand Down

0 comments on commit 8315b04

Please sign in to comment.