-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqa_collector_db.py
112 lines (80 loc) · 3.7 KB
/
sqa_collector_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
"""
This file has been automatically generated with workbench_alchemy v0.2.1
For more details please check here:
https://github.com/PiTiLeZarD/workbench_alchemy
"""
USE_MYSQL_TYPES = True
try:
from . import USE_MYSQL_TYPES
except:
pass
from sqlalchemy.orm import relationship
from sqlalchemy import Column, ForeignKey
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
if USE_MYSQL_TYPES:
from sqlalchemy.dialects.mysql import INTEGER, VARCHAR, DATETIME, ENUM, TEXT
else:
from sqlalchemy import Integer as INTEGER, String as VARCHAR, DateTime as DATETIME, Enum as ENUM, String as TEXT
DECLARATIVE_BASE = declarative_base()
class SqaCorrelatorObject(DECLARATIVE_BASE):
__tablename__ = 'sqa_correlator_objects'
__table_args__ = (
{'mysql_engine': 'InnoDB', 'sqlite_autoincrement': True, 'mysql_charset': 'utf8'}
)
id = Column(INTEGER, autoincrement=True, primary_key=True, nullable=False) # pylint: disable=invalid-name
sqa_correlator_id = Column(
INTEGER, ForeignKey("sqa_correlator.id", onupdate="CASCADE", ondelete="CASCADE"), index=True, nullable=False
)
object = Column(VARCHAR(45), nullable=False)
percentage = Column(INTEGER, nullable=False)
sqaCorrelator = relationship("SqaCorrelator", foreign_keys=[sqa_correlator_id], backref="sqaCorrelatorObjects")
def __repr__(self):
return self.__str__()
def __str__(self):
return "<SqaCorrelatorObject(%(id)s)>" % self.__dict__
class SqaCollector(DECLARATIVE_BASE):
__tablename__ = 'sqa_collector'
__table_args__ = (
{'mysql_engine': 'InnoDB', 'sqlite_autoincrement': True, 'mysql_charset': 'utf8'}
)
id = Column(INTEGER, autoincrement=True, primary_key=True, nullable=False) # pylint: disable=invalid-name
started = Column(DATETIME, nullable=False)
ended = Column(DATETIME)
raised_by = Column(VARCHAR(45), default='unknown', nullable=False)
afi = Column(ENUM('ipv4','ipv6'), default='ipv4', nullable=False)
short = Column(VARCHAR(100))
long = Column(TEXT(100))
def __repr__(self):
return self.__str__()
def __str__(self):
return "<SqaCollector(%(id)s)>" % self.__dict__
class SqaCollectorCorrelator(DECLARATIVE_BASE):
__tablename__ = 'sqa_collector_correlator'
__table_args__ = (
UniqueConstraint('collector_id', 'correlator_id', name='collector_correlator_idx'),
{'mysql_engine': 'InnoDB', 'sqlite_autoincrement': True, 'mysql_charset': 'utf8'}
)
id = Column(INTEGER, autoincrement=True, primary_key=True, nullable=False) # pylint: disable=invalid-name
collector_id = Column(
INTEGER, ForeignKey("sqa_collector.id", onupdate="CASCADE", ondelete="CASCADE"), index=True, nullable=False
)
correlator_id = Column(
INTEGER, ForeignKey("sqa_correlator.id", onupdate="CASCADE", ondelete="CASCADE"), index=True, nullable=False
)
sqaCorrelator = relationship("SqaCorrelator", foreign_keys=[correlator_id], backref="sqaCollectorCorrelator")
sqaCollector = relationship("SqaCollector", foreign_keys=[collector_id], backref="sqaCollectorCorrelator")
def __repr__(self):
return self.__str__()
def __str__(self):
return "<SqaCollectorCorrelator(%(id)s)>" % self.__dict__
class SqaCorrelator(DECLARATIVE_BASE):
__tablename__ = 'sqa_correlator'
__table_args__ = (
{'mysql_engine': 'InnoDB', 'sqlite_autoincrement': True, 'mysql_charset': 'utf8'}
)
id = Column(INTEGER, autoincrement=True, primary_key=True, nullable=False) # pylint: disable=invalid-name
def __repr__(self):
return self.__str__()
def __str__(self):
return "<SqaCorrelator(%(id)s)>" % self.__dict__