{"id":20448593,"url":"https://github.com/datacamp/dbconnectr","last_synced_at":"2025-04-13T01:27:39.191Z","repository":{"id":27520680,"uuid":"111782572","full_name":"datacamp/dbconnectr","owner":"datacamp","description":"Fetch credentials on the fly as you connect to databases","archived":false,"fork":false,"pushed_at":"2023-03-27T09:57:43.000Z","size":63,"stargazers_count":6,"open_issues_count":2,"forks_count":4,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-26T19:12:15.145Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/datacamp.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":"2017-11-23T08:22:20.000Z","updated_at":"2025-02-11T13:25:16.000Z","dependencies_parsed_at":"2024-11-15T10:36:08.774Z","dependency_job_id":"822dd7eb-d372-4ab4-b699-483057a4a0a9","html_url":"https://github.com/datacamp/dbconnectr","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnectr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnectr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnectr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnectr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datacamp","download_url":"https://codeload.github.com/datacamp/dbconnectr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248652973,"owners_count":21140107,"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-11-15T10:35:51.303Z","updated_at":"2025-04-13T01:27:39.152Z","avatar_url":"https://github.com/datacamp.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dbconnectr\n\n[![Build Status](https://api.travis-ci.org/datacamp/dbconnectr.svg?branch=master)](https://travis-ci.org/datacamp/dbconnectr)\n\n### Why use this module?\n\n- Make it easy to discover new databases at DataCamp\n- Allow us to rotate DB credentials, without anyone having to update their scripts\n- Make it easy to open the documentation of a database\n- Allow fine-grained access permissions by using the AWS Key and Secrets for each client.\n\n## Installation\n\nMake sure to ask the IDE team for your AWS Key and Secret.\n\n```bash\n$ pip install awscli\n\n$ aws configure\n\u003e AWS Access Key ID: \u003center your key\u003e\n\u003e AWS Secret Access Key: \u003center your secret\u003e\n\u003e Default region name: us-east-1\n\u003e Default output format: \u003cleave blank\u003e\n```\n\nAfter this, start R, and:\n\n```R\nif(!require(remotes)) {\n  install.packages(\"remotes\")\n}\n\nremotes::install_github(\"datacamp/dbconnectr\")\nremotes::install_github(\"r-dbi/RMySQL\") # for MySQL databases\nremotes::install_github(\"r-dbi/RPostgres\") # for PostgreSQL databases\n```\n\n## How to use\n\n**For security reasons, we only allow DB connections from our VPN.**\n\n```R\nlibrary(dbconnectr)\n\n# List all available databases\nget_databases()\n\n# Get DBI connection to specific database\nconn \u003c- create_connection(\"main-app\")\n\n# Use DBI connection like you normally do\nlibrary(DBI)\ndbListTables(conn)\n\n# Visit the database documentation\nget_docs(\"main-app\")\n```\n\nTo avoid the (time costly) fetching of credentials to AWS every time, `dbconnectr` allows you to cache the credentials on your local machine:\n\n```R\nlibrary(dbconnectr)\n\n# First time is slow\nconn \u003c- create_connection(\"main-app\", cache = TRUE)\n\n# Second time is fast\nconn \u003c- create_connection(\"main-app\", cache = TRUE)\n```\n\n## Use in RStudio\n\nThe `aws` executable will not be found when you're working in RStudio (because the `PATH` is not properly set). To fix this, open up a terminal to find out the location of the `aws` executable:\n\n```bash\n$ which aws\n/Library/Frameworks/Python.framework/Versions/3.6/bin\n```\n\nNext, create a file `~/.Renviron` that adds this `bin` folder to the `PATH`, e.g.:\n\n```bash\nPATH=\"/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}\"\n```\n\n_Note that the exact location of the `aws` executable can be different on your system, depending on how you installed the AWS CLI._ Now, if you start RStudio and your R session initializes, the folder that contains the `aws` executable will be in your `PATH`, and you should be able to call `aws` commands:\n\n```\n\u003e system2(\"aws\", args = \"--version\")\naws-cli/1.14.32 Python/3.6.4 Darwin/17.3.0 botocore/1.8.36\n```\n\n## AWS Parameter Store Structure\n\nSee [README of dbconnect-python project](https://github.com/datacamp/dbconnect-python#aws-parameter-store-structure).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Fdbconnectr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatacamp%2Fdbconnectr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Fdbconnectr/lists"}