FastAPI with PostgreSQL Part 1
<p>We continue with the <a href="https://fastapi.tiangolo.com/" rel="noopener ugc nofollow" target="_blank">FastAPI</a> Series and this time we are going to connect our application to a <a href="https://www.postgresql.org/" rel="noopener ugc nofollow" target="_blank">PostgreSQL</a> Database, we are also going to do a couple of tests with <a href="https://docs.pytest.org/en/7.2.x/" rel="noopener ugc nofollow" target="_blank">Pytest</a>, all this on <a href="https://www.docker.com/" rel="noopener ugc nofollow" target="_blank">Docker</a> to have the necessary infrastructure, so, in short, we will see:</p>
<ul>
<li>API Dockerization.</li>
<li>Infrastructure with Docker Compose. (DB — API)</li>
<li><a href="https://sqlmodel.tiangolo.com/" rel="noopener ugc nofollow" target="_blank">SQLModel</a> for tables.</li>
<li>Connection with <a href="https://www.postgresql.org/" rel="noopener ugc nofollow" target="_blank">PostgreSQL</a>.</li>
<li>Testing with <a href="https://docs.pytest.org/en/7.2.x/" rel="noopener ugc nofollow" target="_blank">Pytest</a>.</li>
</ul>
<p>The first thing we are going to do is clone our previous <a href="https://github.com/arturocuicas/fastapi_base.git" rel="noopener ugc nofollow" target="_blank">Project</a> and we are going to Dockerize it, for this, we are going to do it in the simplest way possible, in future chapters we will do it <strong><em>multi-staging</em></strong> so that it gets closer to a <strong>Production</strong> image.</p>
<p>First of all, we are going to create our <strong><em>Dockerfile</em></strong> file where we are going to indicate the <strong>Python</strong> image that we are going to use and we will install the dependencies through <a href="https://python-poetry.org/" rel="noopener ugc nofollow" target="_blank">Poetry</a>.</p>
<p><a href="https://medium.com/@arturocuicas/fastapi-with-postgresql-part-1-70a3960fb6ee"><strong>Click Here</strong></a></p>