def get_pit_table_definition(self): ctx = {'gen': self} #return loader.render_to_string('codegen/hub/HubSateliteTableGenerator.txt', context=ctx) return render_template( 'codegen/hub/HubPITGenerator_TableDefinition.txt', ctx, format_sql=True)
def get_hub_loader_proc_text(self, hub_loader): self.hub_key_fields_from_stage_table = [] self.hub_loader = hub_loader self.hub_key_fields = [] self.hub_loader_proc_name = self.stage_table.table_name + '_load_' + self.hub_loader.hub.table_name self.hub_load_procedure_names.append( self.hub_loader_proc_name ) self.hub_loader.hub.hubkeyfield_set.all().order_by('pk') for hub_loader_field in \ self.hub_loader.hubloaderfield_set.all().order_by('pk'): if hub_loader_field.purpose != 'hub key field': continue hub_field = hub_loader_field.get_corresponding_hub_field() if hub_field is None: raise CodeGenerationError('''Processing hub loader "{}" and while processing field "{}" failed to find a corresponding hub field either because there was not a field in the hub with the same name, or the hub_field_name property was not present '''.format ( self.hub_loader, hub_loader_field )) self.hub_key_fields.append(hub_field) self.hub_key_fields_from_stage_table.append(hub_loader_field.stage_table_field) ctx = {'gen' : self } return render_template('codegen/stage_table/StageTableCodeGenerator_HubLoaderProc.txt', ctx, format_sql=True)
def get_link_satelite_loader_proc_text(self, link_satelite_loader): self.link_satelite_fields_from_stage_table = [] self.link_satelite_loader = link_satelite_loader self.link_satelite_fields = [] for link_satelite_loader_field in \ self.link_satelite_loader.linksateliteloaderfield_set.all().order_by('pk'): link_satelite_field = link_satelite_loader_field.get_corresponding_link_satelite_field() if link_satelite_field is None: raise CodeGenerationError('''Processing link satelite loader "{}" and while processing field "{}" failed to find a corresponding link satelite field either because there was not a field in the satelite with the same name, or the link_satelite_field_name property was not present '''.format ( self.link_satelite_loader, link_satelite_loader_field )) self.link_satelite_fields.append(link_satelite_field) self.link_satelite_fields_from_stage_table.append(link_satelite_loader_field.stage_table_field) self.link_satelite_loader_proc_name = "{}_load_{}".format( self.stage_table.table_name, self.link_satelite_loader.link_satelite.table_name) self.link_satelite_load_procedure_names.append(self.link_satelite_loader_proc_name) ctx = {'gen' : self } return render_template('codegen/stage_table/StageTableCodeGenerator_LinkSateliteLoaderProc.txt', ctx, format_sql=True)
def get_call_load_procedures_text(self): ctx = {'gen' : self } return render_template('codegen/stage_table/StageTableCodeGenerator_CallLoadProcedures.txt', ctx, format_sql=False)
def get_combined_view_text(self): ctx = {'gen' : self } return render_template('codegen/stage_table/StageTableCodeGenerator_CombinedView.txt', ctx, format_sql=True)
def get_augmented_table_insert_proc_text(self): ctx = {'gen' : self } return render_template('codegen/stage_table/StageTableCodeGenerator_AugmentedTableInsertProc.txt', ctx, format_sql=True)
def get_artifact_text(self): ctx = {'sat_table_generator': self} #return loader.render_to_string('codegen/link/LinkSateliteTableGenerator.txt', context=ctx) return render_template('codegen/link/LinkSateliteTableGenerator.txt', ctx)
def get_artifact_text(self): ctx = {'link_table_generator': self} return render_template('codegen/link/LinkTable.txt', ctx)
def get_redt_text(self): ctx = {'gen': self} #return loader.render_to_string('codegen/hub/HubSateliteTableGenerator.txt', context=ctx) return render_template('codegen/hub/HubSateliteREDTGenerator.txt', ctx)