{"id":29040379,"url":"https://github.com/amadou-6e/py-dockerdb","last_synced_at":"2025-08-26T11:34:04.825Z","repository":{"id":293912569,"uuid":"984606398","full_name":"amadou-6e/py-dockerdb","owner":"amadou-6e","description":"Docker-DB is a Python library for managing database containers via Docker: supporting fast, scriptable setup of MongoDB, PostgreSQL, MySQL, and SQL Server for development and testing.","archived":false,"fork":false,"pushed_at":"2025-06-09T08:46:11.000Z","size":424,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-29T06:33:59.927Z","etag":null,"topics":["containerization","database","devops","docker","docker-python","mongodb","mysql","pgvector","postgresql","python","sql-server","testing","vector-database","vectorstore","vectorstores"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amadou-6e.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2025-05-16T07:52:42.000Z","updated_at":"2025-06-09T08:46:14.000Z","dependencies_parsed_at":"2025-05-20T09:26:54.481Z","dependency_job_id":"8a48c111-b43a-4ba2-a2c4-2f4cbf5b33a4","html_url":"https://github.com/amadou-6e/py-dockerdb","commit_stats":null,"previous_names":["amadou-6e/docker-db","amadou-6e/py-dockerdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amadou-6e/py-dockerdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amadou-6e%2Fpy-dockerdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amadou-6e%2Fpy-dockerdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amadou-6e%2Fpy-dockerdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amadou-6e%2Fpy-dockerdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amadou-6e","download_url":"https://codeload.github.com/amadou-6e/py-dockerdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amadou-6e%2Fpy-dockerdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272214419,"owners_count":24893201,"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-08-26T02:00:07.904Z","response_time":60,"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":["containerization","database","devops","docker","docker-python","mongodb","mysql","pgvector","postgresql","python","sql-server","testing","vector-database","vectorstore","vectorstores"],"created_at":"2025-06-26T14:05:06.279Z","updated_at":"2025-08-26T11:34:04.804Z","avatar_url":"https://github.com/amadou-6e.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker-DB\n\nA Python library for managing containerized databases through Docker. This library provides a simple interface for creating, configuring, and managing database containers for development and testing environments, from within python.\n\n## Features\n\nThe following features are supported:\n\n- Easy setup and management of database containers\n- Automated container lifecycle management\n- Standardized configuration interfaces\n- Connection management and health checking\n- Volume persistence capabilities\n- Initialization script support\n\nThe following features are implemented but not tested:\n- Enable/Disable error if already created\n- startdb\n- restartdb\n- init scripts to examples\n\nThe following databases are supported:\n  - MongoDB\n  - Microsoft SQL Server\n  - PostgreSQL\n  - MySQL\n\nThese databases might be added in the future:\n- Cassandra\n\n## Installation\n\n```bash\npip install py-dockerdb\n```\n\n## Requirements\n\n- Python 3.7+\n- Docker installed and running\n- Database-specific Python drivers:\n  - `pymongo` for MongoDB\n  - `pyodbc` for Microsoft SQL Server\n  - `psycopg2` for PostgreSQL\n  - `mysql-connector-python` for MySQL\n\n## Basic Usage\n\nCheck out the following usage examples:\n\n### MongoDB Example\n\n```python\nfrom docker_db.mongodb import MongoDBConfig, MongoDB\n\n# Create configuration\nconfig = MongoDBConfig(\n    user=\"testuser\",\n    password=\"testpass\",\n    database=\"testdb\",\n    root_username=\"admin\",\n    root_password=\"adminpass\",\n    container_name=\"test-mongodb\"\n)\n\n# Create and start MongoDB container\ndb = MongoDB(config)\ndb.create_db()\n\n# Connect to database\nclient = db.connection\n# Use the database...\n\n# Stop the container when done\ndb.stop_db()\n\n# Completely remove the container\ndb.delete_db()\n```\n\n### PostgreSQL Example\n\n```python\nfrom docker_db.postgres import PostgresConfig, PostgresDB\n\n# Create configuration\nconfig = PostgresConfig(\n    user=\"testuser\",\n    password=\"testpass\",\n    database=\"testdb\",\n    container_name=\"test-postgres\"\n)\n\n# Create and start PostgreSQL container\ndb = PostgresDB(config)\ndb.create_db()\n\n# Connect to the database\nconn = db.connection\n\n# Create a cursor and execute a query\ncursor = conn.cursor()\ncursor.execute(\"SELECT version();\")\nversion = cursor.fetchone()\nprint(f\"PostgreSQL version: {version[0]}\")\n\n# Clean up\ncursor.close()\ndb.stop_db()\n```\n\n### Working with Initialization Scripts\n\nAll database managers support initialization scripts that can be executed when the container is created:\n\n```python\nfrom pathlib import Path\nfrom docker_db.mongodb import MongoDBConfig, MongoDB\n\nconfig = MongoDBConfig(\n    user=\"testuser\",\n    password=\"testpass\",\n    database=\"testdb\",\n    root_username=\"admin\",\n    root_password=\"adminpass\",\n    container_name=\"test-mongodb\",\n    init_script=Path(\"./path/to/init_script.js\")\n)\n```\n\n### Custom Volume Paths\n\nYou can specify custom volume paths to persist data between container restarts:\n\n```python\nfrom pathlib import Path\nfrom docker_db.mssql import MSSQLConfig, MSSQLDB\n\nconfig = MSSQLConfig(\n    user=\"testuser\",\n    password=\"testpass\",\n    database=\"testdb\",\n    sa_password=\"StrongPassword123!\",\n    container_name=\"test-mssql\",\n    volume_path=Path(\"./data/mssql\")\n)\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famadou-6e%2Fpy-dockerdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famadou-6e%2Fpy-dockerdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famadou-6e%2Fpy-dockerdb/lists"}