Customize the default connections in the Connections Pane

Motivation

One of the main reasons we've purchased RStudio Server Pro is to make it as easy as possible for our employees to be productive using R at work. As an R admin, I want to make the path from "I want to use R at work" to "I'm using R at work productively" as short as possible. Without RStudio Server, a potential new R user has to do all of the following before they're ready to do analysis on actual company data:

  1. Install R on their machine
  2. Install RStudio Desktop
  3. Configure R to point to our internal package repository
  4. Install database drivers
  5. Figure out how to connect to a database
  6. Figure out how to get data out of the database into R

Just having RStudio Server Pro allows me to replace steps 1 - 4 with "go to this URL". That's great! But can I do something to help with 5 and 6 as well?

Making better default connections

In RStudio Server's Connections pane, when you click "New Connection", you see a list of the ODBC drivers that are installed and clicking on one leads to a prompt for the necessary connection details.

Like most companies, we have a couple of big databases that hold the majority of data a user might be interested in accessing. And I know what the server name, port, etc is for those databases, so wouldn't it be great if I could fill in that box that pops up, so that new users don't have to chase down all of the connection details? Well, it turns out I can.

Following the guide here (specifically the part about Snippet Files), I added named connections for our company's most commonly used databases.

Here's a screenshot of "New Connection" menu after I created /etc/rstudio/conections/Analytics Data Mart.R per the instructions linked above.

image

So now the path from "I want to use R at work" to "I'm using R at work productively" has just 3 steps:

  1. Go to my-rstudio-server-DNS in your browser and log in
  2. Select a connection from the Connections pane and connect to a databse
  3. Figure out how to get data out of the database into R

Next I'm working on a First Project Template to make step 3 as smooth as possible for new users!

7 Likes

This sounds great! Happy to hear that Snippet Files are proving useful. Always good to hear these success stories!

+1 for RStudio Extensions. Not many people take advantage of RStudio's extensibility features. Nice work.

2 Likes

Out of curiosity, how did you manage database credential in your case ?

On my side, I am using DSN on the system to add a new connection button. Recently, we are working on a package that hide credentials and offer a shiny miniUI to choose the database connection.

What to do with credentials is a challenge, but I wonder if it is because our surrounding environment is not suitable and not ease things at all.

I'll be happy to have your experience. Thanks !

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.