I have a FastAPI application that uses a connection pool for basic CRUD operations and user permission checking.
I am now setting up a TIPG tile server that needs a connection to the same database for 2 reasons:
- The default behaviour of TIPG: Get geographical data. Uses it’s own DB pool:
asyncpg.create_pool_b()
based onfrom buildpg import asyncpg
- Checking user permissions: Check if the user can only see the geographical data associated to that user. Uses custom implementation of
sessionmaker
based onsqlalchemy.ext.asyncio
I’m seeing a conflict in these 2 DB connections that live next to eachother. The same program will have 2 different ways of connecting to the database.
I get the following error, as soon as I use the second DB connection to check for user permissions.
FileNotFoundError: [Errno 2] No such file or directory
Do you know if it is a bad practice to have multiple programs from the same server, each make their own connection pool to the same database? Or is there most likely an issue with my code.