28 lines
938 B
Python
28 lines
938 B
Python
![]() |
from sqlalchemy import Column, Integer, String, UniqueConstraint, Date, DateTime
|
||
|
from sqlalchemy.orm import declarative_base
|
||
|
from datetime import datetime, timezone
|
||
|
|
||
|
|
||
|
# Crear la base declarativa
|
||
|
Base = declarative_base()
|
||
|
|
||
|
# Se define modelo de eventos modificados al procesar
|
||
|
class ModificadosEv(Base):
|
||
|
__tablename__ = "modificados_ev"
|
||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||
|
evento_uuid = Column(String, nullable=False)
|
||
|
publicado_fecha = Column(DateTime, nullable=False)
|
||
|
attribute_count = Column(Integer, nullable=False)
|
||
|
__table_args__ = (
|
||
|
UniqueConstraint('evento_uuid', 'attribute_count', name='ev_attr'),
|
||
|
)
|
||
|
|
||
|
|
||
|
def to_dict(self):
|
||
|
return {
|
||
|
"id": self.id,
|
||
|
"evento_uuid": self.evento_uuid,
|
||
|
"publicado_fecha": self.publicado_fecha, # Se mantendrá como datetime
|
||
|
"attribute_count": self.attribute_count
|
||
|
|
||
|
}
|