Skip to content

Commit 12b1f4f

Browse files
author
Alex Meadows
committed
process_tracker_python-130 Add flag for is_partition in source_object_attribute
✨ Added field for source object attributes to be flagged as partition fields Requirement was specifically for files/data stores that allow for partitioning. When flag is set, those are the field(s) that the data should be partitioned on. This is separate from is_key. Closes: #130
1 parent d936fea commit 12b1f4f

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

dbscripts/mysql_process_tracker.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ create table source_object_attribute_lkup
532532
default_value_number decimal null,
533533
is_key boolean default FALSE not null,
534534
is_filter boolean default FALSE not null,
535+
is_partition boolean default FALSE not null,
535536
constraint source_object_attribute_lkup_udx01
536537
unique (source_object_id, source_object_attribute_name),
537538
constraint source_object_attribute_lkup_fk01

dbscripts/postgresql_process_tracker.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ create table process_tracker.source_object_attribute_lkup
781781
default_value_string varchar(250),
782782
default_value_number numeric,
783783
is_key boolean default false not null,
784-
is_filter boolean default false not null
784+
is_filter boolean default false not null,
785+
is_partition boolean default false not null
785786
);
786787

787788
alter table process_tracker.source_object_attribute_lkup owner to pt_admin;

process_tracker/models/source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class SourceObjectAttribute(Base):
318318
default_value_number = Column(Numeric, nullable=True)
319319
is_key = Column(Boolean, nullable=False, default=False)
320320
is_filter = Column(Boolean, nullable=False, default=False)
321+
is_partition = Column(Boolean, nullable=False, default=False)
321322

322323
UniqueConstraint(source_object_id, source_object_attribute_name)
323324

process_tracker/process_tracker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ def find_process_source_attributes(self, process):
704704
SourceObjectAttribute.source_object_attribute_name,
705705
SourceObjectAttribute.is_key,
706706
SourceObjectAttribute.is_filter,
707+
SourceObjectAttribute.is_partition,
707708
)
708709
.join(SourceObject, SourceObjectAttribute.source_objects)
709710
.join(Source, SourceObject.sources)
@@ -724,6 +725,7 @@ def find_process_source_attributes(self, process):
724725
"source_object_attribute_name": attribute.source_object_attribute_name,
725726
"is_key": attribute.is_key,
726727
"is_filter": attribute.is_filter,
728+
"is_partition": attribute.is_partition,
727729
}
728730
)
729731

@@ -745,6 +747,7 @@ def find_process_target_attributes(self, process):
745747
SourceObjectAttribute.source_object_attribute_name,
746748
SourceObjectAttribute.is_key,
747749
SourceObjectAttribute.is_filter,
750+
SourceObjectAttribute.is_partition,
748751
)
749752
.join(SourceObject, SourceObjectAttribute.source_objects)
750753
.join(Source, SourceObject.sources)
@@ -765,6 +768,7 @@ def find_process_target_attributes(self, process):
765768
"target_object_attribute_name": attribute.source_object_attribute_name,
766769
"is_key": attribute.is_key,
767770
"is_filter": attribute.is_filter,
771+
"is_partition": attribute.is_partition,
768772
}
769773
)
770774

tests/test_process_tracker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,13 +2060,15 @@ def test_find_process_source_attributes(self):
20602060
"source_object_attribute_name": "attr_1",
20612061
"is_key": False,
20622062
"is_filter": False,
2063+
"is_partition": False,
20632064
},
20642065
{
20652066
"source_name": "source",
20662067
"source_object_name": "source_table",
20672068
"source_object_attribute_name": "attr_2",
20682069
"is_key": False,
20692070
"is_filter": False,
2071+
"is_partition": False,
20702072
},
20712073
]
20722074

@@ -2093,13 +2095,15 @@ def test_find_process_target_attributes(self):
20932095
"target_object_attribute_name": "attr_1",
20942096
"is_key": False,
20952097
"is_filter": False,
2098+
"is_partition": False,
20962099
},
20972100
{
20982101
"target_name": "target",
20992102
"target_object_name": "target_table",
21002103
"target_object_attribute_name": "attr_2",
21012104
"is_key": False,
21022105
"is_filter": False,
2106+
"is_partition": False,
21032107
},
21042108
]
21052109

0 commit comments

Comments
 (0)