Metadata-Version: 2.4
Name: djanquiltdb-plugin-postgres-objects
Version: 1.0.0
Summary: DjanQuiltDB decorators for functions/views as declared by django-postgres-objects
Author-email: DjanQuiltDB Project <djanquiltdb@portal42.net>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/DjanQuiltDB/djanquiltdb
Project-URL: Documentation, https://djanquiltdb.readthedocs.io/en/latest/plugins/postgres-objects/index.html
Project-URL: Source, https://github.com/DjanQuiltDB/djanquiltdb/tree/master/packages/djanquiltdb-plugin-postgres-objects
Project-URL: Issues, https://github.com/DjanQuiltDB/djanquiltdb/issues
Project-URL: Changelog, https://github.com/DjanQuiltDB/djanquiltdb/blob/master/packages/djanquiltdb-plugin-postgres-objects/CHANGELOG.rst
Keywords: django,database,sharding,postgresql,migrations
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Framework :: Django
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Topic :: Database
Requires-Python: >=3.14
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: django<7.0,>=6.0
Requires-Dist: djanquiltdb<5.0,>=4.0
Requires-Dist: django-postgres-objects<2.0,>=1.0
Provides-Extra: lint
Requires-Dist: ruff==0.15.21; extra == "lint"
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Requires-Dist: psycopg[binary]>=3.0.0; extra == "test"
Requires-Dist: dj-database-url; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx<10,>=8; extra == "docs"
Provides-Extra: dev
Requires-Dist: djanquiltdb-plugin-postgres-objects[docs,lint,test]; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: tox>=4.21; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

.. The logo needs an absolute URL: this README is the PyPI long description, where a relative path renders broken.

.. image:: https://raw.githubusercontent.com/DjanQuiltDB/djanquiltdb/master/assets/icon-128.png
    :alt: DjanQuiltDB
    :width: 128

===================================
djanquiltdb-plugin-postgres-objects
===================================

.. image:: https://img.shields.io/pypi/v/djanquiltdb-plugin-postgres-objects.svg
    :target: https://pypi.org/project/djanquiltdb-plugin-postgres-objects/
    :alt: PyPI

.. image:: https://img.shields.io/pypi/pyversions/djanquiltdb-plugin-postgres-objects.svg
    :target: https://pypi.org/project/djanquiltdb-plugin-postgres-objects/
    :alt: Supported Python versions

.. image:: https://img.shields.io/pypi/frameworkversions/django/djanquiltdb-plugin-postgres-objects.svg
    :target: https://pypi.org/project/djanquiltdb-plugin-postgres-objects/
    :alt: Supported Django versions

.. image:: https://img.shields.io/badge/postgres-17%20%7C%2018-4169e1?logo=postgresql&logoColor=white
    :target: https://www.postgresql.org/
    :alt: Supported PostgreSQL versions

.. image:: https://github.com/DjanQuiltDB/djanquiltdb/actions/workflows/ci.yml/badge.svg
    :target: https://github.com/DjanQuiltDB/djanquiltdb/actions/workflows/ci.yml
    :alt: CI

.. image:: https://readthedocs.org/projects/djanquiltdb/badge/?version=latest
    :target: https://djanquiltdb.readthedocs.io/en/latest/plugins/postgres-objects/index.html
    :alt: Documentation

.. image:: https://img.shields.io/pypi/l/djanquiltdb-plugin-postgres-objects.svg
    :target: https://github.com/DjanQuiltDB/djanquiltdb/blob/master/LICENSE
    :alt: BSD-3-Clause licence

`django-postgres-objects <https://github.com/djanquiltdb/django-postgres-objects>`_ declares Postgres functions and
views as classes and lets ``makemigrations`` manage them. `DjanQuiltDB <https://github.com/djanquiltdb/djanquiltdb>`_
shards a database across schemas and nodes. This library serves as a compatibility layer between them, allowing you to
mark declarative functions and views as sharded::

    # example/functions.py
    from djanquiltdb.decorators import public_function
    from postgres_objects import Function


    @public_function()
    class AllUppercase(Function):
        arguments = 'input TEXT'
        returns = 'TEXT'
        volatility = 'IMMUTABLE'
        strict = True
        parallel = 'SAFE'
        body = """
            BEGIN
                RETURN UPPER(input);
            END;
        """

Install it through DjanQuiltDB's extra::

    pip install djanquiltdb[postgres-objects]

The decorators are importable from ``djanquiltdb.decorators`` beside the model ones, as above.

Functions get ``@public_function``, ``@mirrored_function`` and ``@sharded_function``; views get ``@public_view``,
``@mirrored_view`` and ``@sharded_view``. An unannotated declaration is placed in the public schema, so declarations
written for a single-database project keep working once that project is sharded.

Full documentation is at https://djanquiltdb.readthedocs.io/en/latest/plugins/postgres-objects/index.html.

Development
===========

This package is developed in the `DjanQuiltDB repository <https://github.com/DjanQuiltDB/djanquiltdb>`_ beside
``djanquiltdb`` itself. Tests run through tox against the Postgres containers in the repository's
``docker-compose.yml``; see ``DOCKER.md`` at the repository root::

    docker compose run --rm test tox

Requirements
------------

* Python 3.14
* Django 6.0 or 6.1
* PostgreSQL 17 or 18
* djanquiltdb 4.x
* django-postgres-objects 1.x
