Skip to content

Instantly share code, notes, and snippets.

@milnak
Created October 23, 2024 22:17
Show Gist options
  • Save milnak/6b32f6aa63f1a99e4024aa5b8e6e50e2 to your computer and use it in GitHub Desktop.
Save milnak/6b32f6aa63f1a99e4024aa5b8e6e50e2 to your computer and use it in GitHub Desktop.
Dump scoop sqllite cache
import sqlite3
database = 'C:/Users/jeffm/scoop/scoop.db'
try:
with sqlite3.connect(database) as conn:
cur = conn.cursor()
cur.execute("""
SELECT DISTINCT
bucket,
name,
description,
FIRST_VALUE(version) OVER (
PARTITION BY bucket,name ORDER BY version DESC
) latest_version
FROM
app
WHERE
bucket NOT IN ('java', 'versions')
ORDER BY
bucket ASC, name ASC, version DESC
""")
rows = cur.fetchall()
for row in rows:
print(f'{row[0]}/{row[1]} v{row[3]} : {row[2]}')
except sqlite3.Error as e:
print (e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment