”;
CockroachDB or Cockroach Database (CRDB) is developed by computer software company Cockroach Labs. It is a scalable, consistently-replicated, transactional datastore which is designed to store copies of data in multiple locations in order to deliver speedy access.
Peewee provides support to this database by way of CockroachDatabase class defined in playhouse.cockroachdb extension module. The module contains definition of CockroachDatabase as subclass of PostgresqlDatabase class from the core module.
Moreover, there is run_transaction() method which runs a function inside a transaction and provides automatic client-side retry logic.
Field Classes
The extension also has certain special field classes that are used as attribute in CRDB compatible model.
-
UUIDKeyField – A primary-key field that uses CRDB’s UUID type with a default randomly-generated UUID.
-
RowIDField – A primary-key field that uses CRDB’s INT type with a default unique_rowid().
-
JSONField – Same as the Postgres BinaryJSONField.
-
ArrayField – Same as the Postgres extension, but does not support multi-dimensional arrays.
”;