def __init__(self): self.table=None self.id=None self.fk_field=None self.fk_value=None self.db_fields={} self.self_cursor=db_handler.cursor()
if str(exists).strip() == '1': exit(1) install=check_output(['psql','-U','postgres','-f','db_mon.sql']) #from uuid import uuid1 from settings import logger,db_handler,prod_handler from objects import * #def get_my_mac(): # my_uuid=uuid1() # mac_addr="{0:0>12}".format(hex(my_uuid.node)[2:-1]) # return mac_addr[:2] + ":" + ":".join([mac_addr[i] + mac_addr[i+1] for i in range(2,12,2)]) self_cursor=db_handler.cursor() prod_cursor=prod_handler.cursor() self_cursor.execute("INSERT INTO host_cluster VALUES (1,'t','t','t','localhost','{0}')".format(get_my_mac())) self_cursor.execute("INSERT INTO database_name VALUES (1,1,'t','t','lms_db')") self_cursor.execute("INSERT INTO schema_name VALUES (1,1,'t','t','public')") sn=SchemaName() sn.discover_tables() for tn_id in sn.get_tables(): tn=TableName(tn_id) tn.discover_indexes() tn.discover_toast() toast_id=tn.get_toast_id() if toast_id: ttn=TableToastName(toast_id) ttn.discover_index()