Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
When making structural changes to version tables (for example dropping
columns) there are sometimes situations where some old version records
become futile.

Vacuum deletes all futile version rows which had no changes compared to
previous version.


::
(more...)

        def vacuum(session, model):
    """
    When making structural changes to version tables (for example dropping
    columns) there are sometimes situations where some old version records
    become futile.

    Vacuum deletes all futile version rows which had no changes compared to
    previous version.


    ::


        from sqlalchemy_continuum import vacuum


        vacuum(session, User)  # vacuums user version


    :param session: SQLAlchemy session object
    :param model: SQLAlchemy declarative model class
    """
    version_cls = version_class(model)
    versions = defaultdict(list)

    query = (
        session.query(version_cls)
        .order_by(option(version_cls, 'transaction_column_name'))
    )

    for version in query:
        if versions[version.id]:
            prev_version = versions[version.id][-1]
            if naturally_equivalent(prev_version, version):
                session.delete(version)
        else:
            versions[version.id].append(version)
        


src/s/q/sqlalchemy-continuum-HEAD/sqlalchemy_continuum/__init__.py   sqlalchemy-continuum(Download)
from .transaction import TransactionFactory
from .unit_of_work import UnitOfWork
from .utils import (
    changeset,
    get_bind,

src/s/q/SQLAlchemy-Continuum-1.0-b4/sqlalchemy_continuum/__init__.py   SQLAlchemy-Continuum(Download)
import sqlalchemy as sa
from .manager import VersioningManager
from .operation import Operation
from .unit_of_work import UnitOfWork
from .utils import (