# Explain DB
A Django package that provides an API to expose Django model metadata and structure information.
## Installation
Install the package via pip:
```bash
pip install explain_db
```
## Setup
1. Add `explain_db` to your Django project's `INSTALLED_APPS` in `settings.py`:
```python
INSTALLED_APPS = [
# ... your other apps
'explain_db',
]
```
2. Include the explain_db URLs in your project's main `urls.py`:
```python
from django.urls import path, include
urlpatterns = [
# ... your other URL patterns
path('api/explain/', include('explain_db.urls')),
]
```
## Usage
The package exposes one API endpoint that returns metadata for a specified Django model:
```
GET /api/explain/model/<model_name>/
```
### Example
If you have a model named `User`, you can get its metadata by making a GET request to:
```
GET /api/explain/User/
```
### Response Format
The API returns detailed information about the model including:
- Table name and description
- Column details (name, type, description, relationships, etc.)
- Foreign key relationships
- Field constraints (nullable, blank, default values)
```json
[
{
"table_name": "auth_user",
"table_description": "User model description",
"columns": [
{
"name": "id",
"type": "AutoField",
"description": "",
"is_relation": false,
"nullable": false,
"blank": false,
"default": null,
},
// ... more columns
]
}
]
```
```
GET /api/explain/models/all
```
### Response Format
This endpoint returns metadata for all Django models in installed apps.
## Requirements
- Django >= 3.2
- Django REST Framework >= 3.12.0
- Python >= 3.8
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/Knighthawk-Leo/explain_db",
"name": "explain-db",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "django, model, metadata, api, database",
"author": "Sanskar Dwivedi",
"author_email": "sanskardwivedi003@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a4/c8/f90e2e0253082ae8f4c550298875dfd2c3c19fec0775907923ac0200d813/explain_db-0.1.0.tar.gz",
"platform": null,
"description": "# Explain DB\n\nA Django package that provides an API to expose Django model metadata and structure information.\n\n## Installation\n\nInstall the package via pip:\n\n```bash\npip install explain_db\n```\n\n## Setup\n\n1. Add `explain_db` to your Django project's `INSTALLED_APPS` in `settings.py`:\n\n```python\nINSTALLED_APPS = [\n # ... your other apps\n 'explain_db',\n]\n```\n\n2. Include the explain_db URLs in your project's main `urls.py`:\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n # ... your other URL patterns\n path('api/explain/', include('explain_db.urls')),\n]\n```\n\n## Usage\n\nThe package exposes one API endpoint that returns metadata for a specified Django model:\n\n```\nGET /api/explain/model/<model_name>/\n```\n\n### Example\n\nIf you have a model named `User`, you can get its metadata by making a GET request to:\n\n```\nGET /api/explain/User/\n```\n\n### Response Format\n\nThe API returns detailed information about the model including:\n\n- Table name and description\n- Column details (name, type, description, relationships, etc.)\n- Foreign key relationships\n- Field constraints (nullable, blank, default values)\n\n```json\n[\n {\n \"table_name\": \"auth_user\",\n \"table_description\": \"User model description\",\n \"columns\": [\n {\n \"name\": \"id\",\n \"type\": \"AutoField\",\n \"description\": \"\",\n \"is_relation\": false,\n \"nullable\": false,\n \"blank\": false,\n \"default\": null,\n },\n // ... more columns\n ]\n }\n]\n```\n\n```\nGET /api/explain/models/all\n```\n### Response Format\n\nThis endpoint returns metadata for all Django models in installed apps.\n\n## Requirements\n\n- Django >= 3.2\n- Django REST Framework >= 3.12.0\n- Python >= 3.8\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License. \n",
"bugtrack_url": null,
"license": null,
"summary": "A Django package to expose model metadata via API",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Knighthawk-Leo/explain_db"
},
"split_keywords": [
"django",
" model",
" metadata",
" api",
" database"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "53c4028c90e49c25fa0663237a110d43bc070d41065d6e796cab090dc19e43b7",
"md5": "80bc3a576bb26fd772a9f4f1c99ccc82",
"sha256": "ab17dbd52b729705ae01ed88c0d08b5116225125e2d75f72a2c92e486be5e5a5"
},
"downloads": -1,
"filename": "explain_db-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "80bc3a576bb26fd772a9f4f1c99ccc82",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6913,
"upload_time": "2025-07-18T09:01:55",
"upload_time_iso_8601": "2025-07-18T09:01:55.107300Z",
"url": "https://files.pythonhosted.org/packages/53/c4/028c90e49c25fa0663237a110d43bc070d41065d6e796cab090dc19e43b7/explain_db-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a4c8f90e2e0253082ae8f4c550298875dfd2c3c19fec0775907923ac0200d813",
"md5": "22709145c820dafbe296fe06def57585",
"sha256": "331173e0f91f811555e0f85950320bc5327db981a22d94f1eba54c549285e4a6"
},
"downloads": -1,
"filename": "explain_db-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "22709145c820dafbe296fe06def57585",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6291,
"upload_time": "2025-07-18T09:01:56",
"upload_time_iso_8601": "2025-07-18T09:01:56.577038Z",
"url": "https://files.pythonhosted.org/packages/a4/c8/f90e2e0253082ae8f4c550298875dfd2c3c19fec0775907923ac0200d813/explain_db-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-18 09:01:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Knighthawk-Leo",
"github_project": "explain_db",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"3.2"
]
]
},
{
"name": "djangorestframework",
"specs": [
[
">=",
"3.12.0"
]
]
}
],
"lcname": "explain-db"
}