Skip to content

Instantly share code, notes, and snippets.

@LordNoteworthy
Created November 30, 2015 09:58
Show Gist options
  • Save LordNoteworthy/57278d0a9da068795ce2 to your computer and use it in GitHub Desktop.
Save LordNoteworthy/57278d0a9da068795ce2 to your computer and use it in GitHub Desktop.
gevent
libevent
greenlet
eventlet
class Sample(Base):
__tablename__ = 'samples'
id = Column(Integer, primary_key=True)
sha256 = Column(String, nullable=False, unique=True, index=True)
time_received = Column(DateTime, nullable=False, index=True)
time_analyzed = Column(DateTime, nullable=False, index=True)
scanner_id = Column(Integer, ForeignKey('scanners.id'), index=True)
category_id = Column(Integer, ForeignKey('categories.id'), index=True)
groups_ = relationship('Group', secondary='sample_group_link')
class Scanner(Base):
__tablename__ = 'scanners'
id = Column(Integer, primary_key=True)
detection = Column(String(64), unique=True, index=True)
class Category(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True)
name = Column(String, unique=True, nullable=False, index=True)
class Group(Base):
__tablename__ = 'groups'
id = Column(Integer, primary_key=True)
name = Column(String, nullable=False, index=True)
date_created = Column(Date, default=datetime.date.today(), index=True)
comment = Column(String)
samples_ = relationship('Sample', secondary='sample_group_link')
class SampleGroupLink(Base):
__tablename__ = 'sample_group_link'
sample_id = Column(Integer, ForeignKey('samples.id'), primary_key=True)
group_id = Column(Integer, ForeignKey('groups.id'), primary_key=True)
sample = relationship('Sample', backref=backref('groups'))
group = relationship('Group', backref=backref('samples'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment