An open API service indexing awesome lists of open source software.

https://github.com/mdlincoln/dbns

Load All Tables From A Database Into R Objects
https://github.com/mdlincoln/dbns

Last synced: 5 months ago
JSON representation

Load All Tables From A Database Into R Objects

Awesome Lists containing this project

README

        

---
output:
md_document:
variant: markdown_github
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```

# dbns

[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Travis-CI Build Status](https://travis-ci.org/mdlincoln/dbns.svg?branch=master)](https://travis-ci.org/mdlincoln/dbns)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/mdlincoln/dbns?branch=master&svg=true)](https://ci.appveyor.com/project/mdlincoln/dbns)
[![Coverage Status](https://img.shields.io/codecov/c/github/mdlincoln/dbns/master.svg)](https://codecov.io/github/mdlincoln/dbns?branch=master)

dbns creates a DataBase NameSpace, adding all the tables available from a given database connection into a namespace as `tbl` objects ready to be manipulated by [dplyr].

[dplyr]: https://cran.r-project.org/web/packages/dplyr/index.html

## Example

```{r example}
library(dbns)
library(DBI)
db <- dbConnect(RSQLite::SQLite(), system.file("extdata/dbns.sqlite", package = "dbns"))

dbListTables(db)

attach_database(db, "dbns")

dbns_iris

dbns_mtcars
```

Detach a database namespace when you are done.
Note that dbns does not disconnect the DBI connection.

```{r disconnect}
detach_database("dbns")

dbDisconnect(db)
```