RPostgres

A DBI-compliant interface to PostgreSQL

https://github.com/r-dbi/rpostgres

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 43 committers (7.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

database postgres postgresql r

Keywords from Contributors

sqlite3 interface tidy-data package-creation data-manipulation visualisation geos rmarkdown travis-ci grammar
Last synced: 6 months ago · JSON representation

Repository

A DBI-compliant interface to PostgreSQL

Basic Info
Statistics
  • Stars: 336
  • Watchers: 23
  • Forks: 80
  • Open Issues: 27
  • Releases: 20
Topics
database postgres postgresql r
Created about 11 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Security

README.md

RPostgres

rcc Codecov test coverage CRAN status <!-- badges: end -->

RPostgres is an DBI-compliant interface to the postgres database. It's a ground-up rewrite using C++ and cpp11. Compared to RPostgreSQL, it:

  • Has full support for parameterised queries via dbSendQuery(), and dbBind().

  • Automatically cleans up open connections and result sets, ensuring that you don't need to worry about leaking connections or memory.

  • Is a little faster, saving ~5 ms per query. (For reference, it takes around 5ms to retrieve a 1000 x 25 result set from a local database, so this is decent speed up for smaller queries.)

  • A simplified build process that relies on system libpq.

Installation

```R

Install the latest RPostgres release from CRAN:

install.packages("RPostgres")

Or the the development version from GitHub:

install.packages("remotes")

remotes::install_github("r-dbi/RPostgres") ```

Discussions associated with DBI and related database packages take place on R-SIG-DB. The website Databases using R describes the tools and best practices in this ecosystem.

Basic usage

```R library(DBI)

Connect to the default postgres database

con <- dbConnect(RPostgres::Postgres())

dbListTables(con) dbWriteTable(con, "mtcars", mtcars) dbListTables(con)

dbListFields(con, "mtcars") dbReadTable(con, "mtcars")

You can fetch all results:

res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4") dbFetch(res) dbClearResult(res)

Or a chunk at a time

res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4") while(!dbHasCompleted(res)){ chunk <- dbFetch(res, n = 5) print(nrow(chunk)) }

Clear the result

dbClearResult(res)

Disconnect from the database

dbDisconnect(con) ```

Connecting to a specific Postgres instance

```R library(DBI)

Connect to a specific postgres database i.e. Heroku

con <- dbConnect(RPostgres::Postgres(),dbname = 'DATABASE_NAME', host = 'HOST', # i.e. 'ec2-54-83-201-96.compute-1.amazonaws.com' port = 5432, # or any other port specified by your DBA user = 'USERNAME', password = 'PASSWORD')

```

Design notes

The original DBI design imagined that each package could instantiate X drivers, with each driver having Y connections and each connection having Z results. This turns out to be too general: a driver has no real state, for PostgreSQL each connection can only have one result set. In the RPostgres package there's only one class on the C side: a connection, which optionally contains a result set. On the R side, the driver class is just a dummy class with no contents (used only for dispatch), and both the connection and result objects point to the same external pointer.


Please note that the 'RPostgres' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Owner

  • Name: r-dbi
  • Login: r-dbi
  • Kind: organization

R + databases

GitHub Events

Total
  • Issues event: 8
  • Watch event: 5
  • Delete event: 27
  • Issue comment event: 39
  • Push event: 120
  • Pull request review event: 5
  • Pull request review comment event: 4
  • Pull request event: 75
  • Fork event: 2
  • Create event: 40
Last Year
  • Issues event: 8
  • Watch event: 5
  • Delete event: 27
  • Issue comment event: 39
  • Push event: 120
  • Pull request review event: 5
  • Pull request review comment event: 4
  • Pull request event: 75
  • Fork event: 2
  • Create event: 40

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,517
  • Total Committers: 43
  • Avg Commits per committer: 35.279
  • Development Distribution Score (DDS): 0.303
Past Year
  • Commits: 65
  • Committers: 4
  • Avg Commits per committer: 16.25
  • Development Distribution Score (DDS): 0.169
Top Committers
Name Email Commits
Kirill Müller k****r@m****g 1,057
hadley h****m@g****m 103
Kirill Müller k****r@i****h 81
Jeroen Ooms j****s@g****m 54
antonov548 a****8@g****m 47
Guillaume Horel g****l@g****m 23
Daniel Possenriede p****e@g****m 17
Mateusz Żółtak z****k@z****g 13
Tyler Hunt t****t@u****u 13
Jamie Lentin jm@l****k 9
Tobias t****s@c****m 9
Guillaume Horel g****l@s****m 8
Indrajeet Patil p****e@g****m 8
Josh Schoenbachler j****r@g****m 7
Etienne B. Racine e****r@g****m 7
github-actions[bot] 4****] 6
Jakob Richter c****e@j****e 5
Mauricio Vargas m****1@u****l 5
Murat Tasan m****r@g****m 3
Maëlle Salmon m****n@y****e 3
Jared Kofron j****k@p****m 3
GitHub n****y@g****m 3
Adam Forys a****s@c****m 3
Murat Tasan m****n@s****m 2
Charles Bailey b****c@e****u 2
Edward Ferara 2****1 2
Troels Nielsen t****n@l****m 2
Sebastian Gatscha g****a@t****u 2
RobertZK t****b@g****m 2
Jim Hester j****r@g****m 2
and 13 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 68
  • Total pull requests: 166
  • Average time to close issues: 9 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 53
  • Total pull request authors: 15
  • Average comments per issue: 4.75
  • Average comments per pull request: 1.16
  • Merged pull requests: 125
  • Bot issues: 0
  • Bot pull requests: 32
Past Year
  • Issues: 6
  • Pull requests: 72
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Issue authors: 6
  • Pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.07
  • Merged pull requests: 51
  • Bot issues: 0
  • Bot pull requests: 32
Top Authors
Issue Authors
  • pachadotdev (7)
  • krlmlr (4)
  • mgirlich (3)
  • dpprdan (3)
  • samterfa (2)
  • mmuurr (2)
  • jeffkeller-einc (1)
  • armenic (1)
  • karawoo (1)
  • pedrobtz (1)
  • richfitz (1)
  • bhogan-mitre (1)
  • nick-youngblut (1)
  • ankane (1)
  • jerrinot (1)
Pull Request Authors
  • krlmlr (90)
  • github-actions[bot] (32)
  • jeroen (9)
  • dpprdan (9)
  • pachadotdev (8)
  • maelle (4)
  • galachad (3)
  • Antonov548 (3)
  • toppyy (2)
  • meztez (1)
  • jakob-r (1)
  • artemklevtsov (1)
  • zozlak (1)
  • karawoo (1)
  • pedrobtz (1)
Top Labels
Issue Labels
install (9) bug (8) help wanted (6) feature (5) reprex (4) docs (4)
Pull Request Labels
mergequeue (14) CRAN release :station: (9) blocked (4)

Packages

  • Total packages: 4
  • Total downloads:
    • cran 50,081 last-month
  • Total docker downloads: 11,643,735
  • Total dependent packages: 45
    (may contain duplicates)
  • Total dependent repositories: 176
    (may contain duplicates)
  • Total versions: 73
  • Total maintainers: 1
cran.r-project.org: RPostgres

C++ Interface to PostgreSQL

  • Versions: 21
  • Dependent Packages: 44
  • Dependent Repositories: 175
  • Downloads: 50,081 Last month
  • Docker Downloads: 11,643,735
Rankings
Docker downloads count: 0.0%
Forks count: 0.9%
Stargazers count: 1.2%
Average: 1.3%
Dependent repos count: 1.4%
Downloads: 1.9%
Dependent packages count: 2.1%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/r-dbi/RPostgres
  • Versions: 19
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.0%
Average: 9.6%
Dependent repos count: 10.2%
Last synced: 6 months ago
proxy.golang.org: github.com/r-dbi/rpostgres
  • Versions: 19
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 9.0%
Average: 9.6%
Dependent repos count: 10.2%
Last synced: 6 months ago
conda-forge.org: r-rpostgres
  • Versions: 14
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Forks count: 21.0%
Stargazers count: 22.0%
Average: 24.0%
Dependent repos count: 24.2%
Dependent packages count: 29.0%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.1.0 depends
  • DBI >= 1.1.0 imports
  • Rcpp >= 1.0.7 imports
  • bit64 * imports
  • blob >= 1.2.0 imports
  • hms >= 1.0.0 imports
  • lubridate * imports
  • methods * imports
  • withr * imports
  • DBItest >= 1.7.1 suggests
  • callr * suggests
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check-dev.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/dep-matrix * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/R-CMD-check.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/commit * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/roxygenize * composite
  • ./.github/workflows/style * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v3 composite
.github/workflows/check/action.yml actions
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v2 composite
.github/workflows/custom/after-install/action.yml actions
  • ankane/setup-postgres v1 composite
.github/workflows/fledge.yaml actions
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • actions/checkout v2 composite
.github/workflows/install/action.yml actions
  • ./.github/workflows/get-extra * composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lock.yaml actions
  • dessant/lock-threads v2 composite
.github/workflows/pkgdown-deploy/action.yml actions
  • nick-fields/retry v2 composite
.github/workflows/pkgdown.yaml actions
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • actions/checkout v3 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch master composite
  • r-lib/actions/pr-push master composite
  • r-lib/actions/setup-r master composite
.github/workflows/revdep.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
.github/workflows/style/action.yml actions
  • actions/cache v3 composite
.github/workflows/update-snapshots/action.yml actions
  • peter-evans/create-pull-request v4 composite
.github/workflows/commit/action.yml actions
.github/workflows/custom/before-install/action.yml actions
.github/workflows/dep-matrix/action.yml actions
.github/workflows/dep-matrix-suggests/action.yml actions
.github/workflows/get-extra/action.yml actions
.github/workflows/ghcr.yaml actions
  • actions/checkout v4 composite
  • docker/build-push-action fdf7f43ecf7c1a5c7afe936410233728a8c2d9c2 composite
  • docker/login-action 1f401f745bf57e30b3a2800ad308a87d2ebdf14b composite
  • docker/metadata-action 62339db73c56dd749060f65a6ebb93a6e056b755 composite
  • docker/setup-buildx-action 3762d454f382a89982d79f33e1ff246835322c4d composite
.github/workflows/git-identity/action.yml actions
.github/workflows/pkgdown-build/action.yml actions
.github/workflows/rate-limit/action.yml actions
.github/workflows/roxygenize/action.yml actions
Dockerfile docker
  • ghcr.io/cynkra/rig-ubuntu main build
docker-compose.yml docker
  • ghcr.io/r-dbi/rpostgres main
  • postgres latest