{"id":13736277,"url":"https://github.com/rstudio/pool","last_synced_at":"2025-05-16T14:05:02.732Z","repository":{"id":38803333,"uuid":"59137493","full_name":"rstudio/pool","owner":"rstudio","description":"Object Pooling in R","archived":false,"fork":false,"pushed_at":"2024-10-07T17:00:55.000Z","size":6113,"stargazers_count":253,"open_issues_count":3,"forks_count":34,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-07T20:05:28.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rstudio.github.io/pool/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-18T17:33:18.000Z","updated_at":"2025-03-22T11:14:12.000Z","dependencies_parsed_at":"2024-01-06T14:09:17.258Z","dependency_job_id":"121f3e20-51ad-4fe8-a760-d9cac6c3450c","html_url":"https://github.com/rstudio/pool","commit_stats":{"total_commits":199,"total_committers":12,"mean_commits":"16.583333333333332","dds":0.507537688442211,"last_synced_commit":"7ac5df4faf62323b6e28d36a3ab1576613bcdbc0"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/pool/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"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","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":[],"created_at":"2024-08-03T03:01:18.737Z","updated_at":"2025-05-16T14:05:02.713Z","avatar_url":"https://github.com/rstudio.png","language":"R","funding_links":[],"categories":["R","Tools","Backend"],"sub_categories":["Integrations","Database"],"readme":"pool\n====\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/rstudio/pool/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/pool/actions/workflows/R-CMD-check.yaml)\n[![R build status](https://github.com/rstudio/pool/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/pool/actions)\n[![Codecov test coverage](https://codecov.io/gh/rstudio/pool/graph/badge.svg)](https://app.codecov.io/gh/rstudio/pool)\n\u003c!-- badges: end --\u003e\n\nThe goal of the **pool** package is to abstract away the challenges of database connection management, which is particularly relevant in interactive contexts like Shiny apps that connect to a database.\n\nInstead of creating and closing connections yourself, you create a \"pool\" of connections, and the pool package manages them for you. You never have to create or close connections directly: The pool knows when it should grow, shrink or keep steady. You only need to close the pool when you’re done. The pool works seamlessly with DBI and dplyr, so in most cases using the pool package is as simple replacing `DBI::dbConnect()` with `dbPool()` and adding a call to `poolClose()`.\n\nLearn more about why pool is needed in `vignette(\"why-pool\")`.\n\n(The pool package is actually general enough to allow you to construct a pool of any kind of object, not just database connections, but database connections are currently its primary claim to fame.)\n\n## Usage\n\nHere’s a simple example of using a pool within a Shiny app:\n\n```r\nlibrary(shiny)\nlibrary(dplyr)\nlibrary(pool)\nloadNamespace(\"dbplyr\")\n\npool \u003c- dbPool(RSQLite::SQLite(), dbname = demoDb())\nonStop(function() {\n  poolClose(pool)\n})\n\nui \u003c- fluidPage(\n  textInput(\"cyl\", \"Enter your number of cylinders:\", \"4\"),\n  tableOutput(\"tbl\"),\n  numericInput(\"nrows\", \"How many cars to show?\", 10),\n  plotOutput(\"popPlot\")\n)\n\nserver \u003c- function(input, output, session) {\n  cars \u003c- tbl(pool, \"mtcars\")\n\n  output$tbl \u003c- renderTable({\n    cars %\u003e% filter(cyl == !!input$cyl) %\u003e% collect()\n  })\n  output$popPlot \u003c- renderPlot({\n    df \u003c- cars %\u003e% head(input$nrows) %\u003e% collect()\n    pop \u003c- df %\u003e% pull(\"mpg\", name = \"model\")\n    barplot(pop)\n  })\n}\n\nshinyApp(ui, server)\n```\n\nNote: the `loadNamespace(\"dbplyr\")` line is there to help the [rsconnect](https://github.com/rstudio/rsconnect) package when deploying the application to [shinyapps.io](https://www.shinyapps.io/) or [Posit Connect](https://posit.co/products/enterprise/connect/). Without that line, rsconnect will not detect that the dbplyr package is needed, and the application will not work properly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Fpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fpool/lists"}