knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of rsqlauthandle is to handle in a simple and secure way your sql db servers authentications.
You can install the development version of rsqlauthandle like so:
devtools::install_github('mentoldo/rsqlauthandle')
To use rsqlauthandle in a project:
library(rsqlauthandle) set_credentials(alias = 'postgres_db', dialect = 'postgresql', host = 'localhost', port = '5432', user = 'user', db_name = 'customers')
It sets the credential for a DB conection. Then, we can use it with:
con <- connect_postgres(alias='rsqlauthandle')
con
is a DBIConnection object that we can use to list tables, get a table or query it.
dbListTables(con) dbReadTable(con, 'accounts') dbReadTable(con, "SELECT * FROM accounts")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.