<commit_before>from sqlalchemy import (
    BigInteger,
    Binary,
    Column,
    DateTime,
    Integer,
    String,
)
from sqlalchemy.dialects.postgresql import ARRAY, JSON, TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func

Base = declarative_base()


class Element(Base):
    __tablename__ = 'element'

    id = Column(BigInteger, primary_key=True)
    osm_id = Column(BigInteger, nullable=True, index=True)

    # allowed values: n, w, r
    element_type = Column(String(1))

    changeset = Column(BigInteger, nullable=True)
    attributes = Column(JSON, nullable=True)
    meta = Column(JSON, nullable=True)

    # we need to have the order of members / references to osm_id
    Column("members", ARRAY(Integer))

    created_on = Column(TIMESTAMP, default=func.now())
    updated_on = Column(TIMESTAMP, default=func.now(),
                        onupdate=func.now())<commit_msg>refactored data model after discussion<commit_after>from sqlalchemy import (
    BigInteger,
    Binary,
    Column,
    DateTime,
    Integer,
    Numeric,
    String,
)
from sqlalchemy.dialects.postgresql import JSON, TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func

Base = declarative_base()


class OsmBase(Base):
    __abstract__ = True

    pk = Column(BigInteger, primary_key=True)
    created_on = Column(TIMESTAMP, default=func.now())
    updated_on = Column(TIMESTAMP, default=func.now(),
                        onupdate=func.now())


class Node(OsmBase):
    __tablename__ = 'node'

    id = Column(BigInteger, unique=True)

    tags = Column(JSON, nullable=True)
    meta = Column(JSON, nullable=True)
    changeset = Column(BigInteger, nullable=True)

    lat = Column(Numeric(9, 6), nullable=True)
    lon = Column(Numeric(9, 6), nullable=True)


class Way(OsmBase):
    __tablename__ = 'way'

    id = Column(BigInteger, unique=True)

    tags = Column(JSON, nullable=True)
    meta = Column(JSON, nullable=True)
    changeset = Column(BigInteger, nullable=True)


class WayMember(OsmBase):
    __tablename__ = 'waymember'

    way_id = Column(BigInteger)
    node_id = Column(BigInteger)

    order = Column(Integer, nullable=True)


class Relation(OsmBase):
    __tablename__ = 'relation'

    id = Column(BigInteger, unique=True)

    tags = Column(JSON, nullable=True)
    meta = Column(JSON, nullable=True)
    changeset = Column(BigInteger, nullable=True)


class RelationMember(OsmBase):
    __tablename__ = 'relationmember'

    relation_id = Column(BigInteger)

    # allowed values: n, w, r
    element_type = Column(String(1))
    element_id = Column(BigInteger)

    order = Column(Integer, nullable=True)
    role = Column(String, nullable=True)
{'fraction_non_alphanumeric': 0.1036231884057971, 'fraction_numerical': 0.002173913043478261, 'mean_word_length': 3.768566493955095, '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': '3647538', 'n_tokens_mistral': 923, 'n_tokens_neox': 879, 'n_words': 202}