Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrielhora/django_sqlformatter
Format and syntax highlight SQL queries in Django log
https://github.com/gabrielhora/django_sqlformatter
django logging sql
Last synced: about 1 month ago
JSON representation
Format and syntax highlight SQL queries in Django log
- Host: GitHub
- URL: https://github.com/gabrielhora/django_sqlformatter
- Owner: gabrielhora
- License: mit
- Created: 2018-03-04T14:18:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-04T20:03:53.000Z (almost 7 years ago)
- Last Synced: 2024-11-05T01:35:27.782Z (about 2 months ago)
- Topics: django, logging, sql
- Language: Python
- Homepage:
- Size: 313 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Django SQL Formatter
Format (sqlparse) and syntax highlight (pygments) SQL queries in Django.
#### Install
pip install django-sqlformatter
#### Configure
```python
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'sql': {
'()': 'django_sqlformatter.SqlFormatter',
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'sql',
},
},
'loggers': {
'django.db.backends': {
'handlers': ['console'],
'level': 'DEBUG',
}
}
}
```---
#### Before
![before](before.png)
#### After
![after](after.png)