Skip to content

Commit 6099acf

Browse files
committed
Building models for Process Tracking.
1 parent ec0cc5e commit 6099acf

File tree

5 files changed

+87
-1
lines changed

5 files changed

+87
-1
lines changed

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pipfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ verify_ssl = true
77

88
[packages]
99
sqlalchemy = "*"
10+
sqlalchemy-utils = "*"
11+
dateutil = "*"
12+
python-dateutil = "*"
1013

1114
[requires]
1215
python_version = "3.7"

Pipfile.lock

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/process.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SQLAlchemy Models
2+
# Models for Process entities
3+
4+
from dateutil import parser
5+
6+
from sqlalchemy import Column, ForeignKey, DateTime, Integer, String
7+
from sqlalchemy.ext.declarative import declarative_base
8+
from sqlalchemy.orm import relationship
9+
from sqlalchemy_utils.types import uuid
10+
11+
Base = declarative_base()
12+
default_date = parser.parse('1900-01-01 00:00:00')
13+
14+
15+
class ProcessType(Base):
16+
__tablename__ = 'process_type'
17+
18+
19+
20+
class Process(Base):
21+
__tablename__ = 'process'
22+
process_uuid = Column(uuid.UUIDType(binary=False), primary_key=True)
23+
process_name = Column(String(250), nullable=False, unique=True)
24+
latest_run_low_date_time = Column(DateTime(timezone=True), nullable=False, default=default_date)
25+
latest_run_high_date_time = Column(DateTime(timezone=True), nullable=False, default=default_date)
26+
latest_run_id = Column(Integer, nullable=False, default=0)
27+
latest_run_start_date_time = Column(DateTime(timezone=True), nullable=False, default=default_date)
28+
latest_run_end_date_time = Column(DateTime(timezone=True), nullable=False, default=default_date)
29+
latest_run_process_status = Column(Integer, nullable=False, default=0)
30+
latest_run_record_count = Column(Integer, nullable=False, default=0)
31+
total_record_count = Column(Integer, nullable=False, default=0)
32+
latest_run_actor_id = Column()
33+
process_type_id = Column()
34+
last_failed_run_date_time = Column(DateTime(timezone=True), nullable=False, default=default_date)

process_tracking.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from source import Source
55
from tool import Tool
66

7+
78
class ProcessTracker:
89

910
def __init__(self, process_name, actor_name, tool_name, source_name):
@@ -15,6 +16,6 @@ def __init__(self, process_name, actor_name, tool_name, source_name):
1516

1617
def register_new_process_run(self):
1718
"""
18-
19+
1920
:return:
2021
"""

0 commit comments

Comments
 (0)