From 155e724b640a5595defe30043bd8e897565e3608 Mon Sep 17 00:00:00 2001 From: Charles Leifer Date: Tue, 15 Oct 2024 08:04:26 -0500 Subject: [PATCH] Reduce prominence of cockroachdb in docs. They recently announced that they are abandoning their core open-source offering and switching to fully-proprietary licensing. [skip ci] --- README.rst | 2 +- docs/index.rst | 6 +--- docs/peewee/database.rst | 72 +--------------------------------------- 3 files changed, 3 insertions(+), 77 deletions(-) diff --git a/README.rst b/README.rst index 5feee1128..8e9fe9224 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ Peewee is a simple and small ORM. It has few (but expressive) concepts, making i * a small, expressive ORM * python 2.7+ and 3.4+ -* supports sqlite, mysql, mariadb, postgresql and cockroachdb +* supports sqlite, mysql, mariadb, postgresql * tons of `extensions `_ New to peewee? These may help: diff --git a/docs/index.rst b/docs/index.rst index 44d7ae8b4..871602350 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,7 +13,7 @@ it easy to learn and intuitive to use. * a small, expressive ORM * python 2.7+ and 3.4+ -* supports sqlite, mysql, mariadb, postgresql and cockroachdb +* supports sqlite, mysql, mariadb, postgresql. * :ref:`tons of extensions ` .. image:: postgresql.png @@ -32,10 +32,6 @@ it easy to learn and intuitive to use. :target: peewee/database.html#using-sqlite :alt: sqlite -.. image:: crdb.png - :target: peewee/database.html#using-crdb - :alt: cockroachdb - Peewee's source code hosted on `GitHub `_. New to peewee? These may help: diff --git a/docs/peewee/database.rst b/docs/peewee/database.rst index b50a1290f..a1fa582f5 100644 --- a/docs/peewee/database.rst +++ b/docs/peewee/database.rst @@ -32,7 +32,7 @@ database class provides some basic, database-specific configuration options. pg_db = PostgresqlDatabase('my_app', user='postgres', password='secret', host='10.1.0.9', port=5432) -Peewee provides advanced support for SQLite, Postgres and CockroachDB via +Peewee provides advanced support for SQLite, Postgres and others via database-specific extension modules. To use the extended-functionality, import the appropriate database-specific module and use the database class provided: @@ -51,20 +51,10 @@ the appropriate database-specific module and use the database class provided: db = PostgresqlExtDatabase('my_app', user='postgres', register_hstore=True) - from playhouse.cockroachdb import CockroachDatabase - - # Use CockroachDB. - db = CockroachDatabase('my_app', user='root', port=26257, host='10.1.0.8') - - # CockroachDB connections may require a number of parameters, which can - # alternatively be specified using a connection-string. - db = CockroachDatabase('postgresql://...') - For more information on database extensions, see: * :ref:`postgres_ext` * :ref:`sqlite_ext` -* :ref:`crdb` * :ref:`sqlcipher_ext` (encrypted SQLite database). * :ref:`apsw` * :ref:`sqliteq` @@ -104,7 +94,6 @@ Consult your database driver's documentation for the available parameters: * MySQL: `pymysql `_ * MySQL: `mysqlclient `_ * SQLite: `sqlite3 `_ -* CockroachDB: see `psycopg2 `_ .. _using_postgresql: @@ -183,65 +172,6 @@ parameter, using the symbolic constants in ``psycopg2.extensions``: conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE) -.. _using_crdb: - -Using CockroachDB ------------------ - -Connect to CockroachDB (CRDB) using the :py:class:`CockroachDatabase` database -class, defined in ``playhouse.cockroachdb``: - -.. code-block:: python - - from playhouse.cockroachdb import CockroachDatabase - - db = CockroachDatabase('my_app', user='root', port=26257, host='localhost') - -If you are using `Cockroach Cloud `_, you may -find it easier to specify the connection parameters using a connection-string: - -.. code-block:: python - - db = CockroachDatabase('postgresql://root:secret@host:26257/defaultdb...') - -.. note:: CockroachDB requires the ``psycopg2`` (postgres) Python driver. - -.. note:: - CockroachDB installation and getting-started guide can be - found here: https://www.cockroachlabs.com/docs/stable/install-cockroachdb.html - -CRDB provides client-side transaction retries, which are available using a -special :py:meth:`CockroachDatabase.run_transaction` helper-method. This method -accepts a callable, which is responsible for executing any transactional -statements that may need to be retried. - -Simplest possible example of :py:meth:`~CockroachDatabase.run_transaction`: - -.. code-block:: python - - def create_user(email): - # Callable that accepts a single argument (the database instance) and - # which is responsible for executing the transactional SQL. - def callback(db_ref): - return User.create(email=email) - - return db.run_transaction(callback, max_attempts=10) - - huey = create_user('huey@example.com') - -.. note:: - The ``cockroachdb.ExceededMaxAttempts`` exception will be raised if the - transaction cannot be committed after the given number of attempts. If the - SQL is mal-formed, violates a constraint, etc., then the function will - raise the exception to the caller. - -For more information, see: - -* :ref:`CRDB extension documentation ` -* :ref:`SSL configuration with CockroachDB ` -* :ref:`Arrays ` (postgres-specific, but applies to CRDB) -* :ref:`JSON ` (postgres-specific, but applies to CRDB) - .. _using_sqlite: Using SQLite