{"id":25056974,"url":"https://github.com/finndersen/dbdex","last_synced_at":"2025-09-15T02:10:27.903Z","repository":{"id":272440190,"uuid":"915063110","full_name":"Finndersen/dbdex","owner":"Finndersen","description":"AI agent that can query and answer questions about a database","archived":false,"fork":false,"pushed_at":"2025-01-29T18:09:37.000Z","size":60,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T10:53:51.789Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Finndersen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-10T22:10:48.000Z","updated_at":"2025-03-31T13:38:44.000Z","dependencies_parsed_at":"2025-01-14T13:24:57.321Z","dependency_job_id":"79ef94d3-eb7d-4be6-bbd1-672a3b106fc0","html_url":"https://github.com/Finndersen/dbdex","commit_stats":null,"previous_names":["finndersen/chatdb","finndersen/dbdex"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Finndersen/dbdex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finndersen%2Fdbdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finndersen%2Fdbdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finndersen%2Fdbdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finndersen%2Fdbdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Finndersen","download_url":"https://codeload.github.com/Finndersen/dbdex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finndersen%2Fdbdex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275194018,"owners_count":25421441,"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-09-15T02:00:09.272Z","response_time":75,"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":[],"created_at":"2025-02-06T13:40:00.889Z","updated_at":"2025-09-15T02:10:27.875Z","avatar_url":"https://github.com/Finndersen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DBdex\n\nLike a Pokédex, but for your database. Uses AI to answer questions about your database data or schema using natural language.\n\n## Features\n\n- Automatically generates and executes SQL queries based on natural language input, and displays results\n- Support all major databases (PostgreSQL, MySQL, Oracle, MSSQL, SQLite)\n- Support for multiple AI providers (OpenAI, Anthropic, Mistral, Google, Groq, Ollama)\n- Automatic schema introspection\n- Interactive CLI interface with Markdown-formatted responses and tab completion of commands and table names\n- Query history and result tracking\n- Efficient handling \u0026 display of large result sets (avoids having the LLM generate the data in its response)\n\nTODO:\n- Streaming responses\n- Web interface with graph plotting\n\n## Example\n\n```md\nWelcome to DBdex CLI! Type '/exit' or '/q' to exit. What would you like to know about your database? \nYou: Provide a brief description of each table\nDBdex: Okay, here's a brief description of each table:\n\n • Categories: Stores information about product categories, such as the category name and description.     \n • Customers: Contains information about customers, such as their company name, contact details, and address.\n • Employees: Stores information about employees, such as their name, job title, and contact information.                                         \n • Order Details: Contains details about individual items within an order, such as the product, quantity, and price.                                               \n • Orders: Contains information about customer orders, including order date, ship details, and associated customer and employee IDs.           \n • Products: Stores information about products, such as the product name, category, supplier, and price.\n\nYou: How many customers are there?\nDBdex: There are 93 customers.\nYou: Show the name, phone number and city for all customers from Germany\n                                                       \n  CompanyName                Phone          City            \n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \n  Alfreds Futterkiste        030-0074321    Berlin          \n  Blauer See Delikatessen    0621-08460     Mannheim        \n  Drachenblut Delikatessen   0241-039123    Aachen          \n  Frankenversand             089-0877310    München         \n  Königlich Essen            0555-09876     Brandenburg     \n  Lehmanns Marktstand        069-0245984    Frankfurt a.M.  \n              \nDBdex: Okay, I've displayed the results showing the company name, phone number, and city for all customers from Germany.\nYou: /export customers_germany.csv\nResults exported to customers_germany.csv\n```\n\n\n## Installation\n\nInstall directly from GitHub, specifying the database drivers you need:\n\n```\n# Install with all database drivers\npip install git+https://github.com/Finndersen/dbdex.git[all]\n\n# Install with specific database drivers (choose one or more)\npip install git+https://github.com/Finndersen/dbdex.git[postgres, mysql, oracle, mssql]\n```\n\n## Usage\n\n### CLI Interface\n\nRun the CLI with your model choice and API key:\n\n```\n# Using OpenAI\npython -m dbdex \\\n    --model provider:model_name \\\n    --api-key your_api_key \\\n    --db-uri postgresql://user:pass@localhost:5432/dbname\n```\n\nThe LLM API key can be provided as CLI argument or as environment variable (e.g. `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, etc.).\n\nSupported databases and their connection strings:\n- PostgreSQL: `postgresql://user:pass@localhost:5432/dbname`\n- MySQL: `mysql+pymysql://user:pass@localhost:3306/dbname`\n- Oracle: `oracle+cx_oracle://user:pass@localhost:1521/dbname`\n- MSSQL: `mssql+pyodbc://user:pass@localhost/dbname`\n- SQLite: `sqlite:///path/to/db.sqlite3`\n\nUse `--help` to see available model options (newer ones not in the list should also work)\n\nCLI commands:\n- `/quit`, `/q` or `/exit` - Exit the CLI\n- `/clear` - Clear conversation history (context provided to the LLM)\n- `/sql \u003cquery\u003e` - Execute SQL query directly\n- `/schema [table1,table2,...]` - Show database schema (optionally for specific tables)\n- `/result` - Show details \u0026 results of the last executed query by the LLM\n- `/export [filename]` - Export last query results to CSV (defaults to query_results.csv)\n\n\n## Logging\n\nDBdex uses [Logfire](https://github.com/logfire-sh/logfire) for logging (via `pydantic-ai`). \nCheck [here](https://logfire.pydantic.dev/docs/#logfire) for how to authorize and configure your Logfire project to receive logs from DBdex.\n\nUse the `--debug` CLI option to show logs in the console.\n\n## Development\n\nClone the repository and install in development mode:\n\n```\ngit clone https://github.com/yourusername/dbdex.git\ncd dbdex\nmake install\n```\n\nDevelopment commands:\n\n```\n# Run tests\nmake test\n\n# Format code\nmake format\n\n# Run linters and type checking\nmake lint\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Run tests and linting\n5. Submit a pull request\n\n## License\n\nMIT License\n\n## Credits\n\nBuilt with:\n- [pydantic-ai](https://github.com/jxnl/pydantic-ai) - AI model integration with [Logfire](https://github.com/logfire-sh/logfire) logging\n- [SQLAlchemy](https://www.sqlalchemy.org/) - Database connectivity \u0026 schema introspection\n- [Rich](https://github.com/Textualize/rich) - Rich text rendering\n- [Readline](https://docs.python.org/3/library/readline.html) - Tab completion\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinndersen%2Fdbdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinndersen%2Fdbdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinndersen%2Fdbdex/lists"}