Skip to content

Instantly share code, notes, and snippets.

@johanvdw
Created April 21, 2021 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanvdw/4ee0a8f67f094cc953598248f46ba9a0 to your computer and use it in GitHub Desktop.
Save johanvdw/4ee0a8f67f094cc953598248f46ba9a0 to your computer and use it in GitHub Desktop.
Export drone logs from sqlite to S3
# This simple scripts dumps all logs from drone to a format
# compatible with drone s3 storage (cfr https://docs.drone.io/server/reference/drone-s3-bucket/ )
# MIT license - https://opensource.org/licenses/MIT
import sqlite3
conn = sqlite3.connect("drone_database.sqlite")
select_logs(conn)
cur = conn.cursor()
cur.execute("select * FROM logs")
for r in cur:
with open('logs/'+str(r[0]), 'wb') as file:
file.write(r[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment