Integrating H2 with Python and Flask
Introduction
H2 is a lightweight database server written in Java. It can be embedded in Java applications, or run as a standalone server.
In this tutorial, we’ll review why H2 can be a good option for your projects. We’ll also learn how to integrate H2 with Python by building a simple Flask API.
The Features of H2
H2 was built with performance in mind.
“H2 is a combination of: fast, stable, easy to use, and features”.
Although H2 is prominent mainly because it can be embedded in Java applications, it has some interesting features that also apply to its server version. Let’s see some of them next.
Size and Performance
The .jar file used for the server version is around 2MB. We can download it from the H2 site, bundled with extra scripts and documentation. If we search in Maven Central though, we can download the .jar file on its own.
H2 performance shines in its embedded version. Even so, the official benchmark shows that its client-server version is also impressive.
In-Memory Databases and Encryption
In-Memory