<h3 dir="auto">First Check</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I added a very descriptive title to this issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I used the GitHub search to find a similar issue and didn't find it.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I searched the FastAPI documentation, with the integrated search.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already searched in Google "How to X in FastAPI" and didn't find any information.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already read and followed all the tutorial in the docs and didn't find an answer.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/samuelcolvin/pydantic">Pydantic</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/swagger-api/swagger-ui">Swagger UI</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/Redocly/redoc">ReDoc</a>.</li>
</ul>
<h3 dir="auto">Commit to Help</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I commit to help with one of those options <g-emoji class="g-emoji" alias="point_up_2" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f446.png">👆</g-emoji></li>
</ul>
<h3 dir="auto">Example Code</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="No code, it's a documentation correction (possibly)."><pre class="notranslate"><span class="pl-v">No</span> <span class="pl-s1">code</span>, <span class="pl-s1">it</span>'<span class="pl-s1">s</span> <span class="pl-s1">a</span> <span class="pl-s1">documentation</span> <span class="pl-en">correction</span> (<span class="pl-s1">possibly</span>).</pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">FastAPI's documentation, in it's "<a href="https://fastapi.tiangolo.com/python-types/#pydantic-models" rel="nofollow">Python Types/Pydantic models</a>" section says:</p>
<blockquote>
<p dir="auto">Pydantic is a Python library to perform data validation.</p>
<p dir="auto">You declare the "shape" of the data as classes with attributes.</p>
<p dir="auto">And each attribute has a type.</p>
<p dir="auto">Then you create an instance of that class with some values and it will validate the values, convert them to the appropriate type (if that's the case) and give you an object with all the data.</p>
</blockquote>
<p dir="auto">But Pydantic's documentation, in the "<a href="https://pydantic-docs.helpmanual.io/usage/models/" rel="nofollow">Models</a>" section notes that:</p>
<blockquote>
<p dir="auto">pydantic is primarily a parsing library, <strong>not a validation library</strong>. Validation is a means to an end: building a model which conforms to the types and constraints provided.</p>
</blockquote>
<p dir="auto">Then FastAPI's documentation could be rewritten this way:</p>
<blockquote>
<p dir="auto">Pydantic is a Python library to perform data parsing.</p>
<p dir="auto">You declare the "shape" of the data as classes with attributes.</p>
<p dir="auto">And each attribute has a type.</p>
<p dir="auto">Then you create an instance of that class with some values and it will parse the values, convert them to the appropriate type (if that's the case) and give you an object with all the data.</p>
</blockquote>
<p dir="auto">I did not send a pull request right away because I think it may have been written this way to facilitate the understanding but I think that it's better to be technically correct.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Linux</p>
<h3 dir="auto">Operating System Details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">FastAPI Version</h3>
<p dir="auto">0.68.0</p>
<h3 dir="auto">Python Version</h3>
<p dir="auto">irrelevant</p>
<h3 dir="auto">Additional Context</h3>
<p dir="auto"><em>No response</em></p>
<p dir="auto"><strong>Description</strong></p>
<p dir="auto">I'm using Django ORM + Mysql with fastapi<br>
all works fine</p>
<p dir="auto">but at some point when application have no requests for some period of time I'm getting</p>
<blockquote>
<p dir="auto">2006 mysql server gone away</p>
</blockquote>
<p dir="auto">Most likely Django does some connection checks or closing somehere in the request flow..</p>
<p dir="auto">(I tried to play with CONN_MAX_AGE and close_old_connections in middleware - no luck)</p>
<p dir="auto">any idea how to do it with fastapi ?</p>