cleanup and reorg

This commit is contained in:
Patrick Schratz 2024-07-27 13:33:50 +02:00
commit 2e5939ace8
Signed by: pat-s
GPG key ID: 3C6318841EF78925

View file

@ -22,3 +22,31 @@ list_metadata_tables <- function() {
)
dbListTables(con)
}
query_metadata_summary <- function(package_name = NULL, platform = NULL) {
# s3 <- paws.storage::s3(config = list(
# endpoint = "https://s3.eu-central-003.backblazeb2.com",
# region = "eu-central-003"
# ))
# db_local <- s3$get_object(Bucket = "devxy-arm64-r-binaries-db", Key = "metadata.sqlite")
# writeBin(db_local$Body, "/tmp/metadata.sqlite")
# Create a new SQLite connection
con <- dbcon_mem()
# If both package_name and platform are NULL, return the full table
if (is.null(package_name) && is.null(platform)) {
summary <- dbGetQuery(con, "SELECT * FROM metadata_summary")
} else {
# Query the metadata_summary table for the specified package and platform
summary <- dbGetQuery(con, paste0(
"SELECT * FROM metadata_summary WHERE package_name = '",
package_name, "' AND platform = '", platform, "'"
))
}
# Close the SQLite connection
dbDisconnect(con)
return(summary)
}