semvec/pypi-packages huggingface dataset:
django-sql-log-middleware 0.1.8
Write Django's SQL statements to a JSONL log file
License: MIT

# Django SQL Log Middleware

A middleware to write Django SQL queries and stats to a jsonl file. Makes analysis easier when you have log files
that are hundreds of megabytes.

Inspired by the [django-sqlprint-middleware](https://github.com/thebjorn/django-sqlprint-middleware) project

## Installation

```
pip install django-sql-log-middleware
```

Add it to the middleware section of settings.py:

```py
MIDDLEWARE = [
    ...
    'django_sql_log_middleware.SqlLogMiddleware',
]
```

## Output

Output will be written to the path specified in `SQLLOG_LOG` in the below format. Each line is a JSON object
covering a single request. Time is the current unix time. Query time is measured in seconds.

```json
{
        "path": "/path/to/api?abc=1234",
        "time": 1649301150,
        "queries": [
            {"sql": "select * from users", "time": 1.1234},
            {"sql": "select * from things", "time": 4.1234},
        ]
}
```

## Settings

Specify the following settings in your settings.py file:

* **DEBUG** This middleware will only run when DEBUG is set.
* **SQLLOG_MIDDLEWARE** set this variable to `False` disable the middleware without removal. Defaults to `True`
* **SQLLOG_PATH_RE** a regex pattern to only log SQL queries in the matched path(s). Defaults to `.*`
* **SQLLOG_LOG** the file to write out the logs to. Defaults to `django_queries.jsonl`
* **SQLLOG_LOG_POST** log `request.POST` data. Defaults to `False`
* **SQLLOG_LOG_META** log `request.META` data. Defaults to `False`

Any outputs that can't be JSON serialized will be rendered as `<not serializable>`
specargs 0.1.0
A library for request parsing and response serialization that generates OpenAPI Specification files
License: MIT
Requires Python: >=3.7,<4.0
Keywords: OpenAPI,Flask,webargs,marshmallow,Generator

# specargs

**specargs** is a Python library for request parsing and response serialization that generates OpenAPI
Specification files. **specargs** is built upon [marshmallow](https://marshmallow.readthedocs.io),
[apispec](https://apispec.readthedocs.io), and [webargs](https://webargs.readthedocs.io). Full documentation can be
found at <https://specargs.rtfd.io>.

This project is under active development and should be considered unstable until the release of version 1.0.0.