{"id":20448615,"url":"https://github.com/datacamp/dbconnect-python","last_synced_at":"2025-04-13T01:28:06.873Z","repository":{"id":46957798,"uuid":"111544096","full_name":"datacamp/dbconnect-python","owner":"datacamp","description":"Easily connect to all internal databases. Only for internal use.","archived":false,"fork":false,"pushed_at":"2021-11-24T17:31:14.000Z","size":15,"stargazers_count":7,"open_issues_count":7,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T19:12:18.403Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datacamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-21T12:07:23.000Z","updated_at":"2023-07-18T13:40:08.000Z","dependencies_parsed_at":"2022-09-10T21:01:04.372Z","dependency_job_id":null,"html_url":"https://github.com/datacamp/dbconnect-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnect-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnect-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnect-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datacamp%2Fdbconnect-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datacamp","download_url":"https://codeload.github.com/datacamp/dbconnect-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248653226,"owners_count":21140150,"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:55.972Z","updated_at":"2025-04-13T01:28:06.836Z","avatar_url":"https://github.com/datacamp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DBConnect\n\n### Why use this module?\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\nMake sure to ask the IDE team for your AWS Key and Secret.\n```bash\npip install awscli\n\naws 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\npip install git+https://github.com/datacamp/dbconnect-python\n```\nGiven that this package connects to databases, you will most likely need to install the MySQL and/or PostgreSQL clients for your OS.\n\n## How to use\n**For security reasons, we only allow DB connections from our VPN. Make sure to be connected when using this module.**\n\nGet a list of our databases you can connect to:\n```python\nimport dbconnect as dbc\ndbc.get_databases()\n['main-app',\n 'teach-app',\n 'challenges-app',\n 'projects-app',\n 'mobile-app',\n 'messenger-app',\n 'projector-app',\n 'datachats',\n 'timetracker']\n```\n\nConnect to a database and execute pandas queries:\n```python\nimport dbconnect as dbc\nimport pandas as pd\n\nengine = dbc.create_connection(database = 'main-app') # The 'main-app' string you can find from dbc.get_databases()\npd.read_sql('SELECT id, email FROM users ORDER BY id ASC LIMIT 10', engine)\n```\n\nOpen the documentation of a database\n```python\ndbc.get_docs(database=\"main-app\")\nOpening \"https://github.com/datacamp/main-app/wiki/Database-Documentation\"\n```\n\n## AWS Parameter Store Structure\n| Parameter | Value |\n| --------- | ----- |\n| /dbconnect/dbnames | List of `\u003capplication-name\u003e`s, separated with comma. |\n\nFor every application:\n\n| Parameter | Value |\n| --------- | ----- |\n| `/dbconnect/\u003capplication-name\u003e/type` | Type of database (mysql, postgresql) |\n| `/dbconnect/\u003capplication-name\u003e/endpoint` | Endpoint of the replica |\n| `/dbconnect/\u003capplication-name\u003e/port` | Port of the replica |\n| `/dbconnect/\u003capplication-name\u003e/user` | Username of the connection |\n| `/dbconnect/\u003capplication-name\u003e/database` | Name of the database |\n| `/dbconnect/\u003capplication-name\u003e/docs` | URL of the database documentation |\n| `/dbconnect/\u003capplication-name\u003e/password` | Password of the database. **Make sure the `type` is set to `SecureString`** |\n\nThese paramters are managed by terraform. (Ask the IDE team)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Fdbconnect-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatacamp%2Fdbconnect-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacamp%2Fdbconnect-python/lists"}