I currently have a website, made of about 20 micro-services and a (still too large) main monolithic web application. The monolith and multiple micro-services each run queries to the same database, each time having to deal with login to the DB and formatting/running the queries.
I may switch our databases from SQL to NoSQL in the near future; to help this transition, as well as every future modification involving my database, I thought about creating a micro-service that will act as an access point to the database. It will handle the connection, and run the queries passed to it.
- What would be the drawbacks of such an architecture?
- Is passing the queries as strings a reasonable idea, or should I create a wrapper function inside the micro-service for each queries I have to run (like getThatThing() or updateThisItem())?
- Should the micro-service be aware of the type of results for the queries, in order to return an object built with ORM?