LearningTech

Data

Shared Database Pattern

Description

Multiple services access the same database. This is generally considered an anti-pattern in microservices but is common in brownfield projects.

Where to use

  • Simple applications.
  • \n
  • Transitional phase during migration.

Real World Example

Order Service and Customer Service both read tables from the same Oracle instance.

Code Example

class SharedDatabasePattern:
    def __init__(self):
        pass

    def execute(self):
        print('Executing Shared Database Pattern')