jeudi 29 décembre 2022

Python Backend Server Design Patterns: Managing multiple databases through one server

I am relatively new to Python design patterns, and would like to ask for input from more experienced developers, on some possible pattern options for managing two independent databases through one backend server.

DB 1 and DB 2 are entirely independent, but there requires certain aspects where data from DB 2 is processed in the backend and used to update parts of DB 1.

I currently have a working singleton pattern which manages the connection for DB 1, but I am reading that a singleton approach is not recommended in most Python development circles.

So, I am considering implementing a few tweaks to the current singleton for DB 1 and making the connection a reserved pool - But this is where the question arises of how to implement DB 2 into the mixture.

Just from a workload and ease of implementation perspective, the simplest solution would be to just create another singleton connection object for DB 2 and just making sure the two connections are separately managed. But from the reading I am doing, it seems this would be bad engineering.

So I would like to ask what are some acceptable ways to design a backend server when managing multiple databases. Any and all directional guides, or simple pointers to factors I should consider would be greatly appreciated.

Thank you much in advance.

End Product

Aucun commentaire:

Enregistrer un commentaire