{"id":38514976,"url":"https://github.com/deepsense-ai/db-ally","last_synced_at":"2026-01-17T06:27:34.799Z","repository":{"id":231493894,"uuid":"772010792","full_name":"deepsense-ai/db-ally","owner":"deepsense-ai","description":"Efficient, consistent and secure library for querying structured data with natural language","archived":false,"fork":false,"pushed_at":"2025-04-16T15:22:42.000Z","size":2572,"stargazers_count":164,"open_issues_count":11,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-08T15:37:20.559Z","etag":null,"topics":["database","database-agent","llm","natural-language-interface","nlidb","nlp","sql","text-to-sql"],"latest_commit_sha":null,"homepage":"https://db-ally.deepsense.ai","language":"Python","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/deepsense-ai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2024-03-14T11:14:02.000Z","updated_at":"2025-12-04T08:28:46.000Z","dependencies_parsed_at":"2025-04-10T08:29:45.527Z","dependency_job_id":"59eba5e9-f06b-4104-b332-d481a02c1a15","html_url":"https://github.com/deepsense-ai/db-ally","commit_stats":null,"previous_names":["deepsense-ai/db-ally"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/deepsense-ai/db-ally","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsense-ai%2Fdb-ally","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsense-ai%2Fdb-ally/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsense-ai%2Fdb-ally/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsense-ai%2Fdb-ally/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepsense-ai","download_url":"https://codeload.github.com/deepsense-ai/db-ally/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsense-ai%2Fdb-ally/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28502275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","database-agent","llm","natural-language-interface","nlidb","nlp","sql","text-to-sql"],"created_at":"2026-01-17T06:27:34.243Z","updated_at":"2026-01-17T06:27:34.791Z","avatar_url":"https://github.com/deepsense-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"docs/assets/banner-light.svg\"\u003e\n  \u003cimg alt=\"dbally logo\" src=\"docs/assets/banner-dark.svg\" width=\"40%\" height=\"40%\"\u003e\n\u003c/picture\u003e\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n\u003cp\u003e\n  \u003cem\u003eEfficient, consistent and secure library for querying structured data with natural language\u003c/em\u003e\n\u003c/p\u003e\n\n\u003ch3\u003e\n\n[Homepage](https://deepsense.ai/db-ally) | [Documentation](https://db-ally.deepsense.ai/) | [Contact](mailto:db-ally@deepsense.ai)\n\n\u003c/h3\u003e\n\n[![HuggingFace - Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue.svg)](https://huggingface.co/spaces/deepsense-ai/db-ally)\n[![PyPI - License](https://img.shields.io/pypi/l/dbally)](https://pypi.org/project/dbally)\n[![PyPI - Version](https://img.shields.io/pypi/v/dbally)](https://pypi.org/project/dbally)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/dbally)](https://pypi.org/project/dbally)\n\n\u003c/div\u003e\n\n---\n\ndb-ally is an LLM-powered library for creating natural language interfaces to data sources. While it occupies a similar space to the text-to-SQL solutions, its goals and methods are different. db-ally allows developers to outline specific use cases for the LLM to handle, detailing the desired data format and the possible operations to fetch this data.\n\ndb-ally effectively shields the complexity of the underlying data source from the model, presenting only the essential information needed for solving the specific use cases. Instead of generating arbitrary SQL, the model is asked to generate responses in a simplified query language.\n\nThe benefits of db-ally can be described in terms of its four main characteristics:\n\n* **Consistency**: db-ally ensures predictable output formats and confines operations to those predefined by developers, making it particularly well-suited for applications with precise requirements on their behavior or data format\n* **Security**: db-ally prevents direct database access and arbitrary SQL execution, bolstering system safety\n* **Efficiency**: db-ally hides most of the underlying database complexity, enabling the LLM to concentrate on essential aspects and improving performance\n* **Portability**: db-ally introduces an abstraction layer between the model and the data, ensuring easy integration with various database technologies and other data sources.\n\n## Quickstart\n\nIn db-ally, developers define their use cases by implementing [**views**](https://db-ally.deepsense.ai/concepts/views), **filters** and **aggregations**. A list of possible filters and aggregations is presented to the LLM in terms of [**IQL**](https://db-ally.deepsense.ai/concepts/iql) (Intermediate Query Language). Views are grouped and registered within a [**collection**](https://db-ally.deepsense.ai/concepts/views), which then serves as an entry point for asking questions in natural language.\n\nThis is a basic implementation of a db-ally view for an example HR application, which retrieves candidates from an SQL database:\n\n```python\nfrom dbally import decorators, SqlAlchemyBaseView, create_collection\nfrom dbally.llms.litellm import LiteLLM\nfrom sqlalchemy import create_engine\n\nclass CandidateView(SqlAlchemyBaseView):\n    \"\"\"\n    A view for retrieving candidates from the database.\n    \"\"\"\n\n    def get_select(self):\n        \"\"\"\n        Defines which columns to select.\n        \"\"\"\n        return sqlalchemy.select(Candidate.id, Candidate.name, Candidate.country)\n\n    @decorators.view_filter()\n    def from_country(self, country: str):\n        \"\"\"\n        Filter candidates from a specific country.\n        \"\"\"\n        return Candidate.country == country\n\n\nllm = LiteLLM(model_name=\"gpt-3.5-turbo\")\nengine = create_engine(\"sqlite:///examples/recruiting/data/candidates.db\")\n\nmy_collection = create_collection(\"collection_name\", llm)\nmy_collection.add(CandidateView, lambda: CandidateView(engine))\n\nmy_collection.ask(\"Find candidates from United States\")\n```\n\nFor a concrete step-by-step example on how to use db-ally, go to [Quickstart](https://db-ally.deepsense.ai/quickstart/) guide. For a more learning-oriented experience, check our db-ally [Tutorial](https://db-ally.deepsense.ai/tutorials/).\n\n## Motivation\n\ndb-ally was originally developed at [deepsense.ai](https://deepsense.ai). In our work on various projects, we frequently encountered the need to retrieve data from data sources, typically databases, in response to natural language queries.\n\nThe standard approach to this issue involves using the text-to-SQL technique. While this method is powerful, it is also complex and challenging to control. Often, the results were unsatisfactory because the Language Model lacked the necessary context to understand the specific requirements of the application and the business logic behind the data.\n\nThis led us to experiment with a more structured approach. In this method, the developer defines the specific use cases for the Language Model to handle, detailing the desired data format and the possible operations to retrieve this data. This approach proved to be more efficient, predictable, and easier to manage, making it simpler to integrate with the rest of the system.\n\nEventually, we decided to create a library that would allow us to use this approach in a more systematic way, and we made it open-source for the community.\n\n## Installation\n\nTo install db-ally, execute the following command:\n\n```bash\npip install dbally\n```\n\nAdditionally, you can install one of our extensions to use specific features.\n\n* `dbally[litellm]`: Use [100+ LLMs](https://docs.litellm.ai/docs/providers)\n* `dbally[faiss]`: Use [Faiss](https://github.com/facebookresearch/faiss) indexes for similarity search\n* `dbally[langsmith]`: Use [LangSmith](https://www.langchain.com/langsmith) for query tracking\n\n```bash\npip install dbally[litellm,faiss,langsmith]\n```\n\n## License\n\ndb-ally is released under MIT license.\n\n## How db-ally documentation is organized\n\n- [Quickstart](https://db-ally.deepsense.ai/quickstart/) - Get started with db-ally in a few minutes\n- [Concepts](https://db-ally.deepsense.ai/concepts/iql) - Understand the main concepts behind db-ally\n- [How-to guides](https://db-ally.deepsense.ai/how-to/log_runs_to_langsmith) - Learn how to use db-ally in your projects\n- [Tutorials](https://db-ally.deepsense.ai/tutorials) - Follow step-by-step tutorials to learn db-ally\n- [API reference](https://db-ally.deepsense.ai/reference/collection) - Explore the underlying API of db-ally\n\n## Roadmap\n\ndb-ally is actively developed and maintained by a core team at [deepsense.ai](https://deepsense.ai) and a community of contributors.\n\nYou can find a list of planned features and integrations in the [Roadmap](https://db-ally.deepsense.ai/about/roadmap).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsense-ai%2Fdb-ally","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepsense-ai%2Fdb-ally","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsense-ai%2Fdb-ally/lists"}