# Path: sqlalchemy_continuum/utils.py
# def tx_column_name(obj):
#     return option(obj, 'transaction_column_name')
# 
# def end_tx_column_name(obj):
#     return option(obj, 'end_transaction_column_name')


import operator
import sqlalchemy as sa
from sqlalchemy_utils import get_primary_keys, identity
from .utils import tx_column_name, end_tx_column_name
    def next_query(self, obj):
        """
        Returns the query that fetches the next version relative to this
        version in the version history.
        """
        session = sa.orm.object_session(obj)

        return (
            session.query(obj.__class__)
            .filter(
                sa.and_(
                    getattr(obj.__class__, tx_column_name(obj))
                    ==
                    getattr(obj, end_tx_column_name(obj)),
                    *parent_criteria(obj)
                )
            )
        )

    def previous_query(self, obj):
        """
        Returns the query that fetches the previous version relative to this
        version in the version history.
        """
        session = sa.orm.object_session(obj)

        return (
            session.query(obj.__class__)
            .filter(
                sa.and_(

# Path: sqlalchemy_continuum/utils.py
# def tx_column_name(obj):
#     return option(obj, 'transaction_column_name')
# 
# def end_tx_column_name(obj):
#     return option(obj, 'end_transaction_column_name')


# Path: sqlalchemy_continuum/fetcher.py
import operator
import sqlalchemy as sa
from sqlalchemy_utils import get_primary_keys, identity
from .utils import tx_column_name, end_tx_column_name

    def next_query(self, obj):
        """
        Returns the query that fetches the next version relative to this
        version in the version history.
        """
        session = sa.orm.object_session(obj)

        return (
            session.query(obj.__class__)
            .filter(
                sa.and_(
                    getattr(obj.__class__, tx_column_name(obj))
                    ==
                    getattr(obj, end_tx_column_name(obj)),
                    *parent_criteria(obj)
                )
            )
        )

    def previous_query(self, obj):
        """
        Returns the query that fetches the previous version relative to this
        version in the version history.
        """
        session = sa.orm.object_session(obj)

        return (
            session.query(obj.__class__)
            .filter(
                sa.and_(

                    getattr(obj.__class__, end_tx_column_name(obj))