architect-handbook

Software Architect Handbook

View on GitHub

Database-as-a-Service Interface

Overview

Sometimes, client just need a database to query. It could be because they need to query or fetch large amounts of data, or perhaps because external parties are already using tool chains that require a SQL endpoint to work against (e.g., Tableu). In this cases we should take care to separate the database we expose from the database we use inside our service boundary.

One approach is to create a dedicated database designed to be exposed as read-only endpoint, and have this database populated when the data in the underlying database changes.

Martin Fowler has already documented this approach under the name of Reporting Database Pattern but this reporting is not the only reason to use this technique, so a different name reflects the fact that it may have wider applicability.

You may find it appropriate to programatically expose information regarding when the database was last updated.

Where to Use It

Implementing a Mapping Engine

The detail here is in working out how to update.

Compared to Views

Transferring Ownership