microsoft / sqlmlutils

Utility functions for easier usage of SQL Server Machine Learning Services
Other
32 stars 32 forks source link

sql_install.packages creates external package library for R packages #66

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi, I'm checking which packages are already installed (SQL Server 2019) and the related library path using a specific connection string

connection <- connectionInfo( server = "server\\instance", database = "anyDB")

for the SQL server/instance. The default library path is C:\Program Files\Microsoft SQL Server\MSSQL15.MHPROD01\R_SERVICES\library .

sql_installed.packages(connectionString = connection, fields=c("Package", "LibPath", "Attributes", "Scope"))

When running this function to install an arbitrary package (for example "tidyverse" or any other)

sql_install.packages(connectionString = connection, pkgs = "tidyverse", verbose = TRUE, scope = "PUBLIC")

then a new external library path F:\Program Files\Microsoft SQL Server\MSSQL15.MHPROD01\MSSQL\ExternalLibraries\5\1\1\tidyverse\R is created.

Now, when running again

sql_installed.packages(connectionString = connection, fields=c("Package", "LibPath", "Attributes", "Scope"))

I can't find the previously installed new package.

Why is that? And how can I appropriately install new packages using sqlmlutils.

JonathanZhu11 commented 4 years ago

You are doing it correctly - can you paste the output of the second sql_installed.packages call here? I cannot repro your issue on my machine. You should see something like this in the "scope" column:

... rstudioapi "0" "PUBLIC" rvest "0" "PUBLIC" scales "0" "PUBLIC" selectr "0" "PUBLIC" sys "0" "PUBLIC" tibble "0" "PUBLIC" tidyr "0" "PUBLIC" tidyselect "0" "PUBLIC" tidyverse "1" "PUBLIC" tinytex "0" "PUBLIC" utf8 "0" "PUBLIC" viridisLite "0" "PUBLIC" whisker "0" "PUBLIC" withr "0" "PUBLIC" xml2 "0" "PUBLIC" ape NA "SYSTEM" assertthat NA "SYSTEM" base NA "SYSTEM" BH NA "SYSTEM" bit NA "SYSTEM" bit64 NA "SYSTEM" blob NA "SYSTEM" ...

The public packages are the new ones that you just installed, whereas system packages are the ones that were on the machine already.