Skip to content

Commit 8bce79b

Browse files
authored
Merge pull request #120 from OpenDataAlex/process_tracker_python-105
process_tracker_python-105 Add is_key and is_filter checks for source…
2 parents 4dd9b61 + 0960f3e commit 8bce79b

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

dbscripts/mysql_process_tracker.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ create table source_object_attribute
502502
is_pii tinyint(1) default 0 not null,
503503
default_value_string varchar(250) null,
504504
default_value_number decimal null,
505+
is_key boolean default FALSE not null,
506+
is_filter boolean default FALSE not null,
505507
constraint source_object_attribute_udx01
506508
unique (source_object_id, source_object_attribute_name),
507509
constraint source_object_attribute_fk01

dbscripts/postgresql_process_tracker.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ create table process_tracker.source_object_attribute
744744
data_decimal integer,
745745
is_pii boolean default false not null,
746746
default_value_string varchar(250),
747-
default_value_number numeric
747+
default_value_number numeric,
748+
is_key boolean default false not null,
749+
is_filter boolean default false not null
748750
);
749751

750752
alter table process_tracker.source_object_attribute owner to pt_admin;

process_tracker/models/source.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ class SourceObjectAttribute(Base):
225225
is_pii = Column(Boolean, nullable=False, default=False)
226226
default_value_string = Column(String(250), nullable=True)
227227
default_value_number = Column(Numeric, nullable=True)
228+
is_key = Column(Boolean, nullable=False, default=False)
229+
is_filter = Column(Boolean, nullable=False, default=False)
228230

229231
UniqueConstraint(source_object_id, source_object_attribute_name)
230232

process_tracker/process_tracker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ def find_process_source_attributes(self, process):
558558
Source.source_name,
559559
SourceObject.source_object_name,
560560
SourceObjectAttribute.source_object_attribute_name,
561+
SourceObjectAttribute.is_key,
562+
SourceObjectAttribute.is_filter,
561563
)
562564
.join(SourceObject, SourceObjectAttribute.source_objects)
563565
.join(Source, SourceObject.sources)
@@ -576,6 +578,8 @@ def find_process_source_attributes(self, process):
576578
"source_name": attribute.source_name,
577579
"source_object_name": attribute.source_object_name,
578580
"source_object_attribute_name": attribute.source_object_attribute_name,
581+
"is_key": attribute.is_key,
582+
"is_filter": attribute.is_filter,
579583
}
580584
)
581585

@@ -595,6 +599,8 @@ def find_process_target_attributes(self, process):
595599
Source.source_name,
596600
SourceObject.source_object_name,
597601
SourceObjectAttribute.source_object_attribute_name,
602+
SourceObjectAttribute.is_key,
603+
SourceObjectAttribute.is_filter,
598604
)
599605
.join(SourceObject, SourceObjectAttribute.source_objects)
600606
.join(Source, SourceObject.sources)
@@ -613,6 +619,8 @@ def find_process_target_attributes(self, process):
613619
"target_name": attribute.source_name,
614620
"target_object_name": attribute.source_object_name,
615621
"target_object_attribute_name": attribute.source_object_attribute_name,
622+
"is_key": attribute.is_key,
623+
"is_filter": attribute.is_filter,
616624
}
617625
)
618626

tests/test_process_tracker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,11 +2053,15 @@ def test_find_process_source_attributes(self):
20532053
"source_name": "source",
20542054
"source_object_name": "source_table",
20552055
"source_object_attribute_name": "attr_1",
2056+
"is_key": False,
2057+
"is_filter": False,
20562058
},
20572059
{
20582060
"source_name": "source",
20592061
"source_object_name": "source_table",
20602062
"source_object_attribute_name": "attr_2",
2063+
"is_key": False,
2064+
"is_filter": False,
20612065
},
20622066
]
20632067

@@ -2082,11 +2086,15 @@ def test_find_process_target_attributes(self):
20822086
"target_name": "target",
20832087
"target_object_name": "target_table",
20842088
"target_object_attribute_name": "attr_1",
2089+
"is_key": False,
2090+
"is_filter": False,
20852091
},
20862092
{
20872093
"target_name": "target",
20882094
"target_object_name": "target_table",
20892095
"target_object_attribute_name": "attr_2",
2096+
"is_key": False,
2097+
"is_filter": False,
20902098
},
20912099
]
20922100

0 commit comments

Comments
 (0)