# LlamaIndex Readers Integration: Database
## Overview
Database Reader is a tool designed to query and load data from databases efficiently.
### Installation
You can install Database Reader via pip:
```bash
pip install llama-index-readers-database
```
## Usage
```python
from llama_index.core.schema import Document
from llama_index.readers.database import DatabaseReader
# Initialize DatabaseReader with the SQL database connection details
reader = DatabaseReader(
sql_database="<SQLDatabase Object>", # Optional: SQLDatabase object
engine="<SQLAlchemy Engine Object>", # Optional: SQLAlchemy Engine object
uri="<Connection URI>", # Optional: Connection URI
scheme="<Scheme>", # Optional: Scheme
host="<Host>", # Optional: Host
port="<Port>", # Optional: Port
user="<Username>", # Optional: Username
password="<Password>", # Optional: Password
dbname="<Database Name>", # Optional: Database Name
)
# Load data from the database using a query
documents = reader.load_data(
query="<SQL Query>" # SQL query parameter to filter tables and rows
)
```
This loader is designed to be used as a way to load data into
[LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index).
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-database",
"maintainer": "kevinqz",
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": "aws rds, postgres, snowflake, sql",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/3f/d4/52d285b9b3ff1bee581fa30afa580b02cd9557d663570e3d88e89be8b50e/llama_index_readers_database-0.2.0.tar.gz",
"platform": null,
"description": "# LlamaIndex Readers Integration: Database\n\n## Overview\n\nDatabase Reader is a tool designed to query and load data from databases efficiently.\n\n### Installation\n\nYou can install Database Reader via pip:\n\n```bash\npip install llama-index-readers-database\n```\n\n## Usage\n\n```python\nfrom llama_index.core.schema import Document\nfrom llama_index.readers.database import DatabaseReader\n\n# Initialize DatabaseReader with the SQL database connection details\nreader = DatabaseReader(\n sql_database=\"<SQLDatabase Object>\", # Optional: SQLDatabase object\n engine=\"<SQLAlchemy Engine Object>\", # Optional: SQLAlchemy Engine object\n uri=\"<Connection URI>\", # Optional: Connection URI\n scheme=\"<Scheme>\", # Optional: Scheme\n host=\"<Host>\", # Optional: Host\n port=\"<Port>\", # Optional: Port\n user=\"<Username>\", # Optional: Username\n password=\"<Password>\", # Optional: Password\n dbname=\"<Database Name>\", # Optional: Database Name\n)\n\n# Load data from the database using a query\ndocuments = reader.load_data(\n query=\"<SQL Query>\" # SQL query parameter to filter tables and rows\n)\n```\n\nThis loader is designed to be used as a way to load data into\n[LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers database integration",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"aws rds",
" postgres",
" snowflake",
" sql"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9fd207440cf4cee21ce3934b2a5255606ea8c7b7b8ea93437216d4d6e13912e8",
"md5": "b4a8a622349900ba8d6cda2403d1db5a",
"sha256": "2424a33561de7574651895218a60c42d84c035194ea9729f10b2306e6ceb2ffa"
},
"downloads": -1,
"filename": "llama_index_readers_database-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4a8a622349900ba8d6cda2403d1db5a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 3178,
"upload_time": "2024-08-22T03:12:06",
"upload_time_iso_8601": "2024-08-22T03:12:06.210542Z",
"url": "https://files.pythonhosted.org/packages/9f/d2/07440cf4cee21ce3934b2a5255606ea8c7b7b8ea93437216d4d6e13912e8/llama_index_readers_database-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fd452d285b9b3ff1bee581fa30afa580b02cd9557d663570e3d88e89be8b50e",
"md5": "36e4266758456de81a9dcf7c6e7fc1d2",
"sha256": "fe123fde50a8d11a49d722c90c5ae7b90e7ae56a10426f52c3b4abe2aa757dad"
},
"downloads": -1,
"filename": "llama_index_readers_database-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "36e4266758456de81a9dcf7c6e7fc1d2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 2904,
"upload_time": "2024-08-22T03:12:07",
"upload_time_iso_8601": "2024-08-22T03:12:07.524835Z",
"url": "https://files.pythonhosted.org/packages/3f/d4/52d285b9b3ff1bee581fa30afa580b02cd9557d663570e3d88e89be8b50e/llama_index_readers_database-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 03:12:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-database"
}