How and why we use PostgreSQL in Ryax

We use PostgreSQL in Ryax as a way to store information for all our stateful services, each service having a different access credentials and a separate database. On the user side, we also make use of PostgreSQL to store backend workflow data points so developers can easily access, generate and manipulate data when building or operating their backend systems with Ryax.

postgresql-architecture-ryax

There are many different types of databases available nowadays, and developers are blessed with a constantly growing choice of storage technologies and solutions. This choice more than often comes in two flavours: relational or non-relational databases. Relational bases (PostGreSQL for example) store data using rigid schemas, specifying how each data record should look like it terms of content, types, etc. Non-relational databases however, are generally used to store files with non-rigid or unspecified schemas: MongoDB is one of them.

Software integrity is often much easier to enforce on relational databases, so it appeared to be the natural choice for us.

 

Image from https://codewave.com/insights/nagesh-on-when-to-use-mongodb-and-why/

 

At Ryax, we heavily leverage the use of Python: a language we love for its 'open-sourceness' and community, as well as for the productivity it provides and its integrability with a myriad of systems. As you probably already know, Python comes with tons of libraries, among those we have SQLAlchemy, which is used to abstract complex databases' management.

Database compatibility between different versions can be facilitated by the use of Alembic, another famous Python library written by SQLAlchemy's authors, which formally defines a way to associate software releases to database changes, making upgrading and downgrading software versions a breeze.

To have a cutting-edge software all this abstractions come with a huge enphasis on programming patterns:

  • Unit of work: to optimize and handle database connections
  • Singleton: to ensure database connection is shared
  • Factory: to retrieve objects that need joining multiple tables
  • Inversion of control: to ensure database configurations follow best practices

At Ryax, we've historically used PostgreSQL for its reliability, stability, and for it being open-source. This widely used object-relational database system resisted the proof of time by many standards, which means it can be used for real production projects in good confidence.

Nevertheless, we believe it is always good practive to prepare ahead for any changes that might occur in your development environment, and that is why we maintain our database system as shielded and independent as possible from any given storage solution. You just never know!

Indeed, this is something we've seen numerous times: changes just happen, and not always for the better (see the 2021 Audacity case for example).
One day PostgreSQL may cease to be open-source, or one of our clients may require to use an Oracle solution, etc. We could change our storage solution very fast, with very minimal effort, because the adaptation work would only focus on changing configurations. This is an approach that we heartily recommend 🙂

And don't forget to reach out to us on Discord to keep the discussion going! 💬

  • yiannis georgiou300px

    Yiannis Georgiou

    CTO at Ryax Technologies