# Path: src/rest_toolkit/compat.py
# def add_metaclass(metaclass):
#     """Class decorator for creating a class with a metaclass."""
#     def wrapper(cls):
#         orig_vars = cls.__dict__.copy()
#         orig_vars.pop('__dict__', None)
#         orig_vars.pop('__weakref__', None)
#         slots = orig_vars.get('__slots__')
#         if slots is not None:
#             if isinstance(slots, str):
#                 slots = [slots]
#             for slots_var in slots:
#                 orig_vars.pop(slots_var)
#         return metaclass(cls.__name__, cls.__bases__, orig_vars)
#     return wrapper


import abc
from pyramid.httpexceptions import HTTPNotFound
from sqlalchemy.orm import object_session
from ..compat import add_metaclass
    from pyramid_sqlalchemy import Session as _session_factory

try:
except ImportError:  # pragma: noqa
    _session_factory = None


def _column_keys(query):
    return [(column.primary_key, column.key) for column in query._primary_entity.entity_zero.columns]



# Path: src/rest_toolkit/compat.py
# def add_metaclass(metaclass):
#     """Class decorator for creating a class with a metaclass."""
#     def wrapper(cls):
#         orig_vars = cls.__dict__.copy()
#         orig_vars.pop('__dict__', None)
#         orig_vars.pop('__weakref__', None)
#         slots = orig_vars.get('__slots__')
#         if slots is not None:
#             if isinstance(slots, str):
#                 slots = [slots]
#             for slots_var in slots:
#                 orig_vars.pop(slots_var)
#         return metaclass(cls.__name__, cls.__bases__, orig_vars)
#     return wrapper


# Path: src/rest_toolkit/ext/sql.py
import abc
from pyramid.httpexceptions import HTTPNotFound
from sqlalchemy.orm import object_session
from ..compat import add_metaclass
    from pyramid_sqlalchemy import Session as _session_factory


try:
except ImportError:  # pragma: noqa
    _session_factory = None


def _column_keys(query):
    return [(column.primary_key, column.key) for column in query._primary_entity.entity_zero.columns]



@add_metaclass(abc.ABCMeta)