DESCRIPTION: I am using RStudio and I have a zip file called databse.zip
. The file is encrypted by a password. My goal is to be able to load the file, decrypt it, extract the sqlite database inside (database.db
) and be able to make a query to it.
So far I tried the following:
# Load required packages
library(dotenv)
library(Hmisc)
library(RSQLite)
# Get password
password = Sys.getenv("PASSWORD")
# Load .zip file and decrypt it
test = getZip("databse.zip", password=password)
# Connect to the SQLite database
con = dbConnect(RSQLite::SQLite(), test) # ERROR! Error in path.expand(path) : invalid 'path' argument
# Get list of items from table in the database
my_data = dbGetQuery(con, "SELECT column_name FROM table") # I do not even reach this point
PROBLEM: Basically, I am able to load and decrypt the file but then I have no idea how to connect to the sqlite database and make a query to it.
QUESTION: Would you be able to suggest a smart and elegant way to achieve my goal please? Feel free to use different packages if needed.