Skip to content

Commit

Permalink
Merge pull request #1118 from cynkra/f-pkgdown-pacha
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jun 19, 2022
2 parents 78069a5 + 9e17490 commit eba4610
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
16 changes: 11 additions & 5 deletions vignettes/dm.Rmd
Expand Up @@ -28,18 +28,24 @@ dm objects can be created from individual tables or loaded directly from a relat
For this demonstration, we're going to work with a model hosted on a public server.
The first thing we need is a connection to the RDBMS hosting the data.

``````{r connect}
``````{r connect, eval = FALSE}
library(RMariaDB)
fin_db <- dbConnect(
MariaDB(),
username = 'guest',
password = 'relational',
dbname = 'Financial_ijs',
host = 'relational.fit.cvut.cz'
username = "guest",
password = "relational",
dbname = "Financial_ijs",
host = "relational.fit.cvut.cz"
)
``````

``````{r connect-real}
library(RMariaDB)
fin_db <- dm:::financial_db_con()
``````

We create a dm object from an RDBMS using `dm_from_con()`, passing in the connection object we just created as the first argument.

``````{r load, message = FALSE}
Expand Down
8 changes: 7 additions & 1 deletion vignettes/howto-dm-db.Rmd
Expand Up @@ -33,8 +33,9 @@ Below, we open a connection to the publicly accessible database server using the
Connection details vary from database to database. Before connecting to your own RDBMS, you may want to read `vignette("DBI", package = "DBI")` for further information.


``````{r }
``````{r eval = FALSE}
library(RMariaDB)
my_db <- dbConnect(
MariaDB(),
username = "guest",
Expand All @@ -44,6 +45,11 @@ my_db <- dbConnect(
)
``````

``````{r }
library(RMariaDB)
my_db <- dm:::financial_db_con()
``````

Creating a dm object takes a single call to `dm_from_con()` with the DBI connection object as its argument.

``````{r message = FALSE}
Expand Down

0 comments on commit eba4610

Please sign in to comment.