https://github.com/poissonconsulting/dbflobr
An R package to read and write files to SQLite databases as BLOBs
https://github.com/poissonconsulting/dbflobr
blob cran databases flob sqlite
Last synced: 8 months ago
JSON representation
An R package to read and write files to SQLite databases as BLOBs
- Host: GitHub
- URL: https://github.com/poissonconsulting/dbflobr
- Owner: poissonconsulting
- License: other
- Created: 2018-09-21T21:31:47.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2025-01-14T21:12:00.000Z (over 1 year ago)
- Last Synced: 2025-04-10T14:13:53.695Z (about 1 year ago)
- Topics: blob, cran, databases, flob, sqlite
- Language: R
- Homepage: https://poissonconsulting.github.io/dbflobr/.
- Size: 2.13 MB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# dbflobr 
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://github.com/poissonconsulting/dbflobr/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/poissonconsulting/dbflobr)
[](https://opensource.org/licenses/MIT)
[](https://cran.r-project.org/package=dbflobr)

`dbflobr` reads and writes files to SQLite databases as [flobs](https://github.com/poissonconsulting/flobr).
A flob is a [blob](https://github.com/tidyverse/blob) that preserves the file extension.
## Installation
To install the latest release from [CRAN](https://cran.r-project.org)
```r
install.packages("dbflobr")
```
To install the developmental version from [GitHub](https://github.com/poissonconsulting/dbflobr)
```r
# install.packages("remotes")
remotes::install_github("poissonconsulting/dbflobr")
```
## Demonstration
```{r}
library(dbflobr)
# convert a file to flob using flobr
flob <- flobr::flob(system.file("extdata", "flobr.pdf", package = "flobr"))
str(flob)
# create a SQLite database connection
conn <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
# create a table 'Table1' of data
DBI::dbWriteTable(conn, "Table1", data.frame(IntColumn = c(1L, 2L)))
DBI::dbReadTable(conn, "Table1")
# specify which row to add the flob to by providing a key
key <- data.frame(IntColumn = 2L)
# write the flob to the database in column 'BlobColumn'
write_flob(flob, "BlobColumn", "Table1", key, conn, exists = FALSE)
DBI::dbReadTable(conn, "Table1")
# read the flob
flob2 <- read_flob("BlobColumn", "Table1", key, conn)
str(flob2)
# delete the flob
delete_flob("BlobColumn", "Table1", key, conn)
DBI::dbReadTable(conn, "Table1")
# close the connection
DBI::dbDisconnect(conn)
```
## Inspiration
- [blob](https://github.com/tidyverse/blob)
- [flobr](https://github.com/poissonconsulting/flobr)
## Contribution
Please report any [issues](https://github.com/poissonconsulting/dbflobr/issues).
[Pull requests](https://github.com/poissonconsulting/dbflobr/pulls) are always welcome.
## Code of Conduct
Please note that the dbflobr project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms