Models package¶
Here as a diagram of the simple database followed by their corresponding classes. I think they are simple enough to understand directly ;)
The redirect_rule
, domain_rule
, path_rule
and destination_rule
tables
all have the following two fields:
name | Description | type | other |
---|---|---|---|
created_at | The time this entry was created on | Datetime | now |
modified_at | The last time the entry was modified | Datetime | now |
Redirect Rule¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
domain_rule_id | The ID of the domain rule | Integer | foreign key |
path_rule_id | The ID of the path rule | Integer | foreign key |
destination_rule_id | The ID of the destination rule | Integer | foreign key |
weight | The weight/priority of this rule over the others | Integer | 100 |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
domain_rule_id = Column(Integer, ForeignKey('domain_rule.id'), nullable=False)
path_rule_id = Column(Integer, ForeignKey("path_rule.id"), nullable=False)
destination_rule_id = Column(Integer, ForeignKey("destination_rule.id"), nullable=False)
weight = Column(Integer, nullable=False, default=100)
Path Rule¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
rule | The rule that can be regex or literal in a string | String | required, not null |
is_regex | If the rule is a regex or literal | Boolean | False |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
rule = Column(String(1000))
is_regex = Column(Boolean, default=False)
Domain Rule¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
rule | The rule that can be regex or literal in a string | String | required, not null |
is_regex | If the rule is a regex or literal | Boolean | False |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
rule = Column(String(1000))
is_regex = Column(Boolean, default=False)
Destination Rule¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
destination_url | The destination URL that can have also placeholders | String | required, not null |
is_rewrite | Weather or not the URL has placeholders in it | Boolean | False |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
destination_url = Column(String(1000))
is_rewrite = Column(Boolean, default=False)
Ambiguous Requests¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
request | The full URL of the request that the worker got | String | required, not null |
created_at | The time this entry was created on | Datetime | now |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
request = Column(String(1000), unique=True)
created_at = Column(DateTime, default=datetime.now())
Hyperscan DB Version¶
name | Description | type | other |
---|---|---|---|
id | The primary key | Integer | auto increment |
old_version | The previous version of the HS database | String | nullable |
current_version | The current loaded version of the HS database | String | required, no null |
This is how it looks in Python:
id = Column(Integer, autoincrement=True, primary_key=True)
old_version = Column(String, nullable=True)
current_version = Column(String, nullable=False)