{"id":14067757,"url":"https://github.com/r-dbi/DBI","last_synced_at":"2025-07-30T02:31:25.201Z","repository":{"id":11220671,"uuid":"13610317","full_name":"r-dbi/DBI","owner":"r-dbi","description":"A database interface (DBI) definition for communication between R and RDBMSs","archived":false,"fork":false,"pushed_at":"2025-05-06T02:20:04.000Z","size":19585,"stargazers_count":308,"open_issues_count":15,"forks_count":77,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-07-07T23:37:28.372Z","etag":null,"topics":["database","interface","r"],"latest_commit_sha":null,"homepage":"https://dbi.r-dbi.org","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-dbi.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-10-16T05:17:38.000Z","updated_at":"2025-06-13T18:15:47.000Z","dependencies_parsed_at":"2023-01-13T16:23:40.246Z","dependency_job_id":"b661e1bb-3242-4739-8c43-37e38fd7c32b","html_url":"https://github.com/r-dbi/DBI","commit_stats":{"total_commits":1595,"total_committers":38,"mean_commits":"41.973684210526315","dds":"0.44200626959247646","last_synced_commit":"686983c8611412ed725471a252ebdfa801e23755"},"previous_names":["rstats-db/dbi"],"tags_count":142,"template":false,"template_full_name":null,"purl":"pkg:github/r-dbi/DBI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-dbi%2FDBI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-dbi%2FDBI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-dbi%2FDBI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-dbi%2FDBI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-dbi","download_url":"https://codeload.github.com/r-dbi/DBI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-dbi%2FDBI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267798625,"owners_count":24145727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","interface","r"],"created_at":"2024-08-13T07:05:45.761Z","updated_at":"2025-07-30T02:31:24.849Z","avatar_url":"https://github.com/r-dbi.png","language":"HTML","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# DBI\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![rcc](https://github.com/r-dbi/DBI/workflows/rcc/badge.svg)](https://github.com/r-dbi/DBI/actions)\n[![Coverage Status](https://codecov.io/gh/r-dbi/DBI/branch/main/graph/badge.svg)](https://app.codecov.io/github/r-dbi/DBI?branch=main)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/DBI)](https://cran.r-project.org/package=DBI)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1882/badge)](https://bestpractices.coreinfrastructure.org/projects/1882)\n\u003c!-- badges: end --\u003e\n\nThe DBI package helps connecting R to database management systems (DBMS).\nDBI separates the connectivity to the DBMS into a \"front-end\" and a \"back-end\".\nThe package defines an interface that is implemented by *DBI backends* such as:\n\n- [RPostgres](https://rpostgres.r-dbi.org),\n- [RMariaDB](https://rmariadb.r-dbi.org),\n- [RSQLite](https://rsqlite.r-dbi.org),\n- [odbc](https://github.com/r-dbi/odbc),\n- [bigrquery](https://github.com/r-dbi/bigrquery),\n\nand many more, see the [list of backends](https://github.com/r-dbi/backends#readme).\nR scripts and packages use DBI to access various databases through their DBI backends.\n\nThe interface defines a small set of classes and methods similar in spirit to Perl's [DBI](https://dbi.perl.org/), Java's JDBC, Python's [DB-API](https://www.python.org/dev/peps/pep-0249/), and Microsoft's [ODBC](https://en.wikipedia.org/wiki/ODBC).\nIt supports the following operations:\n\n* connect/disconnect to the DBMS\n* create and execute statements in the DBMS\n* extract results/output from statements\n* error/exception handling\n* information (meta-data) from database objects\n* transaction management (optional)\n\n## Installation\n\nMost users who want to access a database do not need to install DBI directly.\nIt will be installed automatically when you install one of the database backends:\n\n- [RPostgres](https://rpostgres.r-dbi.org) for PostgreSQL,\n- [RMariaDB](https://rmariadb.r-dbi.org) for MariaDB or MySQL,\n- [RSQLite](https://rsqlite.r-dbi.org) for SQLite,\n- [odbc](https://github.com/r-dbi/odbc) for databases that you can access via [ODBC](https://en.wikipedia.org/wiki/Open_Database_Connectivity),\n- [bigrquery](https://github.com/r-dbi/bigrquery),\n- ... .\n\nYou can install the released version of DBI from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"DBI\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"r-dbi/DBI\")\n```\n\n## Example\n\nThe following example illustrates some of the DBI capabilities:\n\n```{r example}\nlibrary(DBI)\n# Create an ephemeral in-memory RSQLite database\ncon \u003c- dbConnect(RSQLite::SQLite(), dbname = \":memory:\")\n\ndbListTables(con)\ndbWriteTable(con, \"mtcars\", mtcars)\ndbListTables(con)\n\ndbListFields(con, \"mtcars\")\ndbReadTable(con, \"mtcars\")\n\n# You can fetch all results:\nres \u003c- dbSendQuery(con, \"SELECT * FROM mtcars WHERE cyl = 4\")\ndbFetch(res)\ndbClearResult(res)\n\n# Or a chunk at a time\nres \u003c- dbSendQuery(con, \"SELECT * FROM mtcars WHERE cyl = 4\")\nwhile (!dbHasCompleted(res)) {\n  chunk \u003c- dbFetch(res, n = 5)\n  print(nrow(chunk))\n}\ndbClearResult(res)\n\ndbDisconnect(con)\n```\n\n## Class structure\n\nThere are four main DBI classes.\nThree which are each extended by individual database backends:\n\n* `DBIObject`: a common base class for all DBI.\n\n* `DBIDriver`: a base class representing overall DBMS properties.\n  Typically generator functions instantiate the driver objects like `RSQLite()`,\n  `RPostgreSQL()`, `RMySQL()` etc.\n\n* `DBIConnection`: represents a connection to a specific database\n\n* `DBIResult`: the result of a DBMS query or statement.\n\nAll classes are _virtual_: they cannot be instantiated directly and instead must be subclassed.\n\n## Further Reading\n\n* [Databases using R](https://db.rstudio.com/) describes the tools and best practices in this ecosystem.\n\n* The [DBI project site](https://r-dbi.org/) hosts a blog where recent developments are presented.\n\n* [A history of DBI](https://dbi.r-dbi.org/articles/DBI-history.html) by David James, the driving force behind the development of DBI, and many of the packages that implement it.\n\n---\n\nPlease note that the _DBI_ project is released with a [Contributor Code of Conduct](https://dbi.r-dbi.org/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-dbi%2FDBI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-dbi%2FDBI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-dbi%2FDBI/lists"}