cleanup and reorg
This commit is contained in:
parent
995ca841d6
commit
2e5939ace8
1 changed files with 103 additions and 68 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue