# Path: sqlalchemy_continuum/utils.py
# def adapt_columns(expr):
#     return VersioningClauseAdapter().traverse(expr)
# 
# def option(obj_or_class, option_name):
#     """
#     Return the option value of given option for given versioned object or
#     class.
# 
#     :param obj_or_class: SQLAlchemy declarative model object or class
#     :param option_name: The name of an option to return
#     """
#     if isinstance(obj_or_class, AliasedClass):
#         obj_or_class = sa.inspect(obj_or_class).mapper.class_
#     cls = obj_or_class if isclass(obj_or_class) else obj_or_class.__class__
#     if not hasattr(cls, '__versioned__'):
#         cls = parent_class(cls)
#     return get_versioning_manager(cls).option(
#         cls, option_name
#     )


from copy import copy
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import column_property
from sqlalchemy_utils.functions import get_declarative_base
from .utils import adapt_columns, option
from .version import VersionClassBase
import six
import sqlalchemy as sa
                order_by=lambda: getattr(
                    self.version_class,
                    option(self.model, 'transaction_column_name')
                ),
                lazy='dynamic',
                viewonly=True
            )
            # We must explicitly declare this relationship, instead of
            # specifying as a backref to the one above, since they are
            # viewonly=True and SQLAlchemy will warn if using backref.
            self.version_class.version_parent = sa.orm.relationship(
                self.model,
                primaryjoin=sa.and_(*conditions),
                foreign_keys=model_keys,
                viewonly=True,
                uselist=False,
            )

    def build_transaction_relationship(self, tx_class):
        """
        Builds a relationship between currently built version class and
        Transaction class.

        :param tx_class: Transaction class
        """
        # Only define transaction relation if it doesn't already exist in
        # parent class.

        transaction_column = getattr(
            self.version_class,

# Path: sqlalchemy_continuum/utils.py
# def adapt_columns(expr):
#     return VersioningClauseAdapter().traverse(expr)
# 
# def option(obj_or_class, option_name):
#     """
#     Return the option value of given option for given versioned object or
#     class.
# 
#     :param obj_or_class: SQLAlchemy declarative model object or class
#     :param option_name: The name of an option to return
#     """
#     if isinstance(obj_or_class, AliasedClass):
#         obj_or_class = sa.inspect(obj_or_class).mapper.class_
#     cls = obj_or_class if isclass(obj_or_class) else obj_or_class.__class__
#     if not hasattr(cls, '__versioned__'):
#         cls = parent_class(cls)
#     return get_versioning_manager(cls).option(
#         cls, option_name
#     )


# Path: sqlalchemy_continuum/model_builder.py
from copy import copy
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import column_property
from sqlalchemy_utils.functions import get_declarative_base
from .utils import adapt_columns, option
from .version import VersionClassBase
import six
import sqlalchemy as sa

                order_by=lambda: getattr(
                    self.version_class,
                    option(self.model, 'transaction_column_name')
                ),
                lazy='dynamic',
                viewonly=True
            )
            # We must explicitly declare this relationship, instead of
            # specifying as a backref to the one above, since they are
            # viewonly=True and SQLAlchemy will warn if using backref.
            self.version_class.version_parent = sa.orm.relationship(
                self.model,
                primaryjoin=sa.and_(*conditions),
                foreign_keys=model_keys,
                viewonly=True,
                uselist=False,
            )

    def build_transaction_relationship(self, tx_class):
        """
        Builds a relationship between currently built version class and
        Transaction class.

        :param tx_class: Transaction class
        """
        # Only define transaction relation if it doesn't already exist in
        # parent class.

        transaction_column = getattr(
            self.version_class,

            option(self.model, 'transaction_column_name')