Created
October 23, 2024 22:17
-
-
Save milnak/6b32f6aa63f1a99e4024aa5b8e6e50e2 to your computer and use it in GitHub Desktop.
Dump scoop sqllite cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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