<commit_before>from datetime import datetime, timezone, timedelta
from c2corg_api.models.user import User
from sqlalchemy import (
    Column,
    Integer,
    String,
    DateTime,
    ForeignKey
    )
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.expression import over, and_, asc
from sqlalchemy.sql.functions import func

from c2corg_api.models import Base, DBSession, schema, users_schema
from c2corg_api.models.document import (
    Document, ArchiveDocument, ArchiveDocumentLocale, ArchiveDocumentGeometry)


class HistoryMetaData(Base):
    __tablename__ = 'history_metadata'

    id = Column(Integer, primary_key=True)
    user_id = Column(
        Integer, ForeignKey(users_schema + '.user.id'), nullable=False,
        index=True)
    user = relationship(
        User, primaryjoin=user_id == User.id, viewonly=True)
    comment = Column(String(200))
    written_at = Column(
        DateTime(timezone=True), default=func.now(), nullable=False,
        index=True)


class DocumentVersion(Base):
    __tablename__ = 'documents_versions'

    id = Column(Integer, primary_key=True)
    document_id = Column(
        Integer, ForeignKey(schema + '.documents.document_id'),
        nullable=False, index=True)
    document = relationship(
        Document, primaryjoin=document_id == Document.document_id,
        backref=backref(
            'versions', viewonly=True, order_by=id))

    lang = Column(
        String(2), ForeignKey(schema + '.langs.lang'),
        nullable=False)

    document_archive_id = Column(
        Integer, ForeignKey(schema + '.documents_archives.id'), nullable=False)
    document_archive = relationship(
        ArchiveDocument, primaryjoin=document_archive_id == ArchiveDocument.id)

    document_locales_archive_id = Column(
        Integer, ForeignKey(schema + '.documents_locales_archives.id'),
        nullable=False)
    document_locales_archive = relationship(<commit_msg>Remove SQLAlchemy warning<commit_after>from datetime import datetime, timezone, timedelta
from c2corg_api.models.user import User
from sqlalchemy import (
    Column,
    Integer,
    String,
    DateTime,
    ForeignKey
    )
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.expression import over, and_, asc
from sqlalchemy.sql.functions import func

from c2corg_api.models import Base, DBSession, schema, users_schema
from c2corg_api.models.document import (
    Document, ArchiveDocument, ArchiveDocumentLocale, ArchiveDocumentGeometry)


class HistoryMetaData(Base):
    __tablename__ = 'history_metadata'

    id = Column(Integer, primary_key=True)
    user_id = Column(
        Integer, ForeignKey(users_schema + '.user.id'), nullable=False,
        index=True)
    user = relationship(
        User, primaryjoin=user_id == User.id, viewonly=True)
    comment = Column(String(200))
    written_at = Column(
        DateTime(timezone=True), default=func.now(), nullable=False,
        index=True)


class DocumentVersion(Base):
    __tablename__ = 'documents_versions'

    id = Column(Integer, primary_key=True)
    document_id = Column(
        Integer, ForeignKey(schema + '.documents.document_id'),
        nullable=False, index=True)
    document = relationship(
        Document, primaryjoin=document_id == Document.document_id,
        backref=backref(
            'versions', viewonly=True, order_by=id),
        sync_backref=False)

    lang = Column(
        String(2), ForeignKey(schema + '.langs.lang'),
        nullable=False)

    document_archive_id = Column(
        Integer, ForeignKey(schema + '.documents_archives.id'), nullable=False)
    document_archive = relationship(
        ArchiveDocument, primaryjoin=document_archive_id == ArchiveDocument.id)

    document_locales_archive_id = Column(
        Integer, ForeignKey(schema + '.documents_locales_archives.id'),
        nullable=False)
    document_locales_archive = relationship(
{'fraction_non_alphanumeric': 0.09382967873533911, 'fraction_numerical': 0.0035696073431922487, 'mean_word_length': 3.8075980392156863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5920631', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1114, 'n_words': 248}