Drivers and ORMs for YugabyteDB

Drivers and ORMs

Drivers and ORMs for YugabyteDB

The Yugabyte Structured Query Language (YSQL) API builds upon and extends a fork of the query layer from PostgreSQL, with the intent of supporting most PostgreSQL functionality. Client applications can use the PostgreSQL drivers to read and write data into YugabyteDB databases. YSQL-compatible PostgreSQL drivers are listed in the compatibility matrix below.

In addition to the compatible upstream PostgreSQL drivers, YugabyteDB also supports smart drivers, which extend the PostgreSQL drivers to enable client applications to connect to YugabyteDB clusters without the need for external load balancers. YugabyteDB smart drivers have the following features:

  • Cluster-aware. Drivers know about all the data nodes in a YugabyteDB cluster, eliminating the need for an external load balancer.
  • Topology-aware. For geographically-distributed applications, the driver can seamlessly connect to the geographically nearest regions and availability zones for lower latency.

All YugabyteDB smart driver libraries are actively maintained, and receive bug fixes, performance enhancements, and security patches.

Note

To take advantage of smart driver load balancing features when connecting to clusters in YugabyteDB Managed, applications using smart drivers must be deployed in a VPC that has been peered with the cluster VPC. For information on VPC networking in YugabyteDB Managed, refer to VPC network.

For applications that access the cluster from a non-peered network, use the upstream PostgreSQL driver instead; in this case, the cluster performs the load balancing. Applications that use smart drivers from non-peered networks fall back to the upstream driver behaviour automatically.

Supported libraries

The following libraries are officially supported by YugabyteDB.

Java

Driver/ORM Support Level Example apps
YugabyteDB JDBC Smart Driver [Recommended] Full CRUD Example
PostgreSQL JDBC Driver Full CRUD Example
Ebean Full CRUD Example
Hibernate Full CRUD Example
Spring Data YugabyteDB Full CRUD Example
Spring Data JPA Full Hello World

Go

Driver/ORM Support Level Example apps
YugabyteDB PGX [Recommended] Full CRUD Example
PGX Full CRUD Example
PQ Full CRUD Example
GORM Full CRUD Example
PG Full CRUD Example

Node.js

Driver/ORM Support Level Example apps
PostgreSQL Full CRUD Example
Sequelize Full CRUD Example
Prisma Full CRUD Example

C#

Name Type Support Example
Npgsql Driver Full CRUD Example
EntityFramework ORM Full CRUD Example

Python

Driver/ORM Support Level Example apps
Yugabyte Psycopg2 [Recommended] Full CRUD Example
PostgreSQL Psycopg2 Full CRUD Example
aiopg Full Hello World
Django Full CRUD Example
SQLAlchemy Full CRUD Example

Rust

Driver/ORM Support Level Example apps
Diesel Full Diesel