Skip to content

Instantly share code, notes, and snippets.

@nemith
Created December 29, 2016 22:36
Show Gist options
  • Save nemith/d6a2575416886b1ec301a187f2a84147 to your computer and use it in GitHub Desktop.
Save nemith/d6a2575416886b1ec301a187f2a84147 to your computer and use it in GitHub Desktop.
RulesSrcObjects = Table('rules_src_objects',
Column('id', Integer, primary_key=True),
Column('rule_id', Integer, ForeignKey('Rule.id')),
Column('object_id', Integer, ForeignKey('Object.id')),
RulesDstbjects = Table('rules_dst_objects',
Column('id', Integer, primary_key=True),
Column('rule_id', Integer, ForeignKey('Rule.id')),
Column('object_id', Integer, ForeignKey('Object.id')),
Class Object(Base):
__tablename__ = 'objects'
id = Column(Integer)
name = Column(String, primary_key=True)
ip = Column(string)
port = Column(int
proto = Column(int)
src_rules = relationship('Rule', secondary=RuleSrcObjects)
dst_rules = relationship('Rule', secondary=RuleDstObjects)
Class Rule(Base):
__tablename__ = 'rules'
rulename = Column(String, primary_key=True)
src_objects = relationship('Objects', secondary=RulesSrcObjects)
dst_objects = relationship('Objects', secondary=RulesDstObjects)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment