@@ -19,6 +19,7 @@ class ExtractStatus(Base):
1919 Integer ,
2020 Sequence ("extract_status_lkup_extract_status_id_seq" , schema = "process_tracker" ),
2121 primary_key = True ,
22+ nullable = False ,
2223 )
2324 extract_status_name = Column (String (75 ), nullable = False , unique = True )
2425
@@ -41,13 +42,16 @@ class Extract(Base):
4142 Integer ,
4243 Sequence ("extract_tracking_extract_id_seq" , schema = "process_tracker" ),
4344 primary_key = True ,
45+ nullable = False ,
4446 )
4547 extract_filename = Column (String (750 ), nullable = False , unique = True )
4648 extract_location_id = Column (
47- Integer , ForeignKey ("process_tracker.location_lkup.location_id" )
49+ Integer , ForeignKey ("process_tracker.location_lkup.location_id" ), nullable = False
4850 )
4951 extract_status_id = Column (
50- Integer , ForeignKey ("process_tracker.extract_status_lkup.extract_status_id" )
52+ Integer ,
53+ ForeignKey ("process_tracker.extract_status_lkup.extract_status_id" ),
54+ nullable = False ,
5155 )
5256 extract_registration_date_time = Column (
5357 DateTime , nullable = False , default = datetime .now ()
@@ -59,9 +63,15 @@ class Extract(Base):
5963 extract_load_high_date_time = Column (DateTime , nullable = True )
6064 extract_load_record_count = Column (Integer , nullable = True )
6165
62- extract_process = relationship ("ExtractProcess" , back_populates = "process_extracts" )
63- extract_status = relationship ("ExtractStatus" , foreign_keys = [extract_status_id ])
64- locations = relationship ("Location" , foreign_keys = [extract_location_id ])
66+ extract_process = relationship (
67+ "ExtractProcess" , back_populates = "process_extracts" , passive_deletes = "all"
68+ )
69+ extract_status = relationship (
70+ "ExtractStatus" , foreign_keys = [extract_status_id ], passive_deletes = "all"
71+ )
72+ locations = relationship (
73+ "Location" , foreign_keys = [extract_location_id ], passive_deletes = "all"
74+ )
6575
6676 def __repr__ (self ):
6777
@@ -85,15 +95,21 @@ class ExtractDependency(Base):
8595 Integer ,
8696 ForeignKey ("process_tracker.extract_tracking.extract_id" ),
8797 primary_key = True ,
98+ nullable = False ,
8899 )
89100 child_extract_id = Column (
90101 Integer ,
91102 ForeignKey ("process_tracker.extract_tracking.extract_id" ),
92103 primary_key = True ,
104+ nullable = False ,
93105 )
94106
95- child_extract = relationship ("Extract" , foreign_keys = [child_extract_id ])
96- parent_extract = relationship ("Extract" , foreign_keys = [parent_extract_id ])
107+ child_extract = relationship (
108+ "Extract" , foreign_keys = [child_extract_id ], passive_deletes = "all"
109+ )
110+ parent_extract = relationship (
111+ "Extract" , foreign_keys = [parent_extract_id ], passive_deletes = "all"
112+ )
97113
98114 def __repr__ (self ):
99115
@@ -112,22 +128,28 @@ class ExtractProcess(Base):
112128 Integer ,
113129 ForeignKey ("process_tracker.extract_tracking.extract_id" ),
114130 primary_key = True ,
131+ nullable = False ,
115132 )
116133 process_tracking_id = Column (
117134 Integer ,
118135 ForeignKey ("process_tracker.process_tracking.process_tracking_id" ),
119136 primary_key = True ,
137+ nullable = False ,
120138 )
121139 extract_process_status_id = Column (
122- Integer , ForeignKey ("process_tracker.extract_status_lkup.extract_status_id" )
140+ Integer ,
141+ ForeignKey ("process_tracker.extract_status_lkup.extract_status_id" ),
142+ nullable = False ,
123143 )
124144 extract_process_event_date_time = Column (
125145 DateTime , nullable = False , default = datetime .now ()
126146 )
127147
128- process_extracts = relationship ("Extract" , foreign_keys = [extract_tracking_id ])
148+ process_extracts = relationship (
149+ "Extract" , foreign_keys = [extract_tracking_id ], passive_deletes = "all"
150+ )
129151 extract_processes = relationship (
130- "ProcessTracking" , foreign_keys = [process_tracking_id ]
152+ "ProcessTracking" , foreign_keys = [process_tracking_id ], passive_deletes = "all"
131153 )
132154
133155 def __repr__ (self ):
@@ -148,10 +170,13 @@ class LocationType(Base):
148170 Integer ,
149171 Sequence ("location_type_lkup_location_type_id_seq" , schema = "process_tracker" ),
150172 primary_key = True ,
173+ nullable = False ,
151174 )
152175 location_type_name = Column (String (25 ), unique = True , nullable = False )
153176
154- locations = relationship ("Location" , back_populates = "location_types" )
177+ locations = relationship (
178+ "Location" , back_populates = "location_types" , passive_deletes = "all"
179+ )
155180
156181 def __repr__ (self ):
157182
@@ -170,16 +195,21 @@ class Location(Base):
170195 Integer ,
171196 Sequence ("location_lkup_location_id_seq" , schema = "process_tracker" ),
172197 primary_key = True ,
198+ nullable = False ,
173199 )
174200 location_name = Column (String (750 ), nullable = False , unique = True )
175201 location_path = Column (String (750 ), nullable = False , unique = True )
176202 location_type = Column (
177- Integer , ForeignKey ("process_tracker.location_type_lkup.location_type_id" )
203+ Integer ,
204+ ForeignKey ("process_tracker.location_type_lkup.location_type_id" ),
205+ nullable = False ,
178206 )
179207
180208 extracts = relationship ("Extract" )
181209
182- location_types = relationship ("LocationType" , foreign_keys = [location_type ])
210+ location_types = relationship (
211+ "LocationType" , foreign_keys = [location_type ], passive_deletes = "all"
212+ )
183213
184214 def __repr__ (self ):
185215
0 commit comments