def remove_search_type(my, node): search_type = my.xml.get_attribute(node, 'code') # get sobject entry search = Search("sthpw/search_object") search.add_filter("search_type", search_type) search_type_sobj = search.get_sobject() if not search_type_sobj: print "WARNING: Search type [%s] does not exist" % search_type else: # dump the table first ??? # get the table and remove it ??? from pyasm.search import DropTable try: table_drop = DropTable(search_type) table_drop.commit() # NOTE: do we need to log the undo for this? except Exception, e: print "Error: ", e.message
print("WARNING: ", e) try: table_name = search_type_obj.get_table() # must log first TableDropUndo.log(search_type, database, table_name) except (SqlException, SearchException), e: print("WARNING: ", e) try: from pyasm.search import DropTable cmd = DropTable(search_type) cmd.commit() except (SqlException, SearchException), e: print("WARNING: ", e) # dump the table to a file and store it in cache #from pyasm.search import TableDataDumper #dumper = TableDataDumper() #dumper.set_info(table) #dumper.execute() # NOTE: already dealt with in DeleteCmd. get all of the pipelines """ pipelines = search_type_obj.get_related_sobjects("sthpw/pipeline")
cmd = DeleteCmd(sobject=sobject, values=my.values) cmd.execute() except (SqlException, SearchException), e: print "WARNING: ", e try: table_name = search_type_obj.get_table() # must log first TableDropUndo.log(search_type, database, table_name) except (SqlException, SearchException), e: print "WARNING: ", e try: from pyasm.search import DropTable cmd = DropTable(search_type) cmd.commit() except (SqlException, SearchException), e: print "WARNING: ", e # dump the table to a file and store it in cache #from pyasm.search import TableDataDumper #dumper = TableDataDumper() #dumper.set_info(table) #dumper.execute() # NOTE: already dealt with in DeleteCmd. get all of the pipelines """ pipelines = search_type_obj.get_related_sobjects("sthpw/pipeline") for pipeline in pipelines: print "deleting: ", pipeline.get_search_key() pipeline.delete()