
First, use the SQL button to generate a new SQL file with the open connection: Great, we’re connected it’s time to make a query! It’s now a lot easier to build and execute SQL queries in RStudio. You can also take advantage of RStudio’s API to prompt for secrets in your own packages. Instead of being prompted to make the password part of the connection string, you’ll get a prompt to save it to your keyring.
Download sql tabs code#
Your password is stored, secure and encrypted, on your system’s credential store (such as the MacOS Keychain or Windows Credential Store), so you can share your R code without leaking your password. RStudio now integrates with the keyring package. In RStudio 1.2, we’ve made it much easier to secure your credentials. It’s not good practice, but it’s understandable it can be a big hassle to store and retrieve the password securely.

When connecting to databases that use usernames and passwords, it’s not uncommon to see passwords stored in plain text in the connection string.

We’ll start by connecting to the database. Today, we’re looking at SQL, and as a motivating example, we’re going to connect to a sample Chinook database to get a list of album titles. Over the next few weeks on the blog, we’re going to be taking a look at improvements for each of these in turn. The RStudio 1.2 Preview Release, available today, dramatically improves support and interoperability with many new programming languages and platforms, including SQL, D3, Python, Stan, and C++.
