프로젝트

일반

사용자정보

통계
| 개정판:

hytos / minorTools / makeClearSql.py @ 8cc915e9

이력 | 보기 | 이력해설 | 다운로드 (4.14 KB)

1
def make_sql_delete_drawing_data():
2
    import os
3
    
4
    sqlPath = os.path.join('E:\Projects\DTIPID_GERRIT\minorTools', 'clear.txt')
5
    
6
    drawing_uids = ['ca0423e7-bde1-4b64-9d4a-45afa09d2b19', 'cf1166cd-b027-4d5e-88b2-d817e8d9638f', \
7
                    'd17b490e-9c33-4451-a727-0cfc076ee8f3', 'd7dd4f37-db5f-433a-b76a-9843027f4307', 'dc4df203-9fd7-47c0-a1c7-704be8f68719', \
8
                    'ecbe6ada-dd70-419f-8bf1-0df8edb524f0', 'f1cdd4b3-d54a-48e8-9855-85cdf426142e', 'f52d3484-f6bc-4a4f-b8a8-04f867b4cbb6', \
9
                    'c78fb418-c005-424a-ace2-0d1f2ffc4bf4', 'baf31801-664a-495e-9980-f2dc12e15af1', 'b3a73579-9ae3-4898-9c9b-f95afbce9ee0', \
10
                    'b34ecc0e-b7b1-4adf-aade-dd45efca674d', 'b34195f8-9d82-47aa-9cb0-c36dc1663818', 'a9d23ee4-9ecc-45f5-b0bb-2dcda5c33073', \
11
                    'a778dcd1-9057-45ff-894e-3175cefe6d1a', 'a5d484fe-2ade-4e1c-9a9b-8dd006c88e47', 'a38c297a-63cf-4b8c-88d2-2f3d0e3b5688', \
12
                    '8559385b-2867-4e0f-a12d-790eaa825675', '84db639f-5d74-401f-b7b6-7a9cf21afbd6', '7e26f3de-a2b2-47cb-9d35-bbd8e2135766', \
13
                    '7d384f5e-78b5-47ac-8149-9133ff920a41', '7ab9dafc-a7cf-41ed-bbb2-b47d15f380ae', '70f7edd3-20ed-48f5-9582-b55ecc91a692', \
14
                    '69c83b39-506d-4374-a3c0-02325c7635fa', '67f11eb7-3a52-44c3-bf6c-fbf9bc5e67ca', '64024d94-6614-49fd-89c3-c01ac2fff4d1', \
15
                    '62ae882f-132e-46ef-b919-0b8b899b56ec', '621050f6-96d4-40b6-af05-375b8bd687a4', '6050692d-b161-438b-8e1b-7963f00c5867', \
16
                    '5f2e285e-063a-4559-8b48-6582f00d6a0c', '5ca8dabc-8915-471f-a7f7-8ba06448f1fa', '59509cac-3ae4-4fb5-a524-c64aa6d0f2d6', \
17
                    '57cf3bb6-bf4d-484c-877b-eff64528ff49', '56525817-8b31-4fad-9109-4ce479f98180', '509aaae4-f815-4d59-9987-bf717f38c481', \
18
                    '4b631ec9-3cd2-4aff-b08d-96ba094e0e8a', '4a10a4eb-9c55-4d80-b94d-704c21707ec1', '48275869-8499-4e81-aa13-f176c696d81b', \
19
                    '46737b5a-48c8-4341-b5a3-5ef4e1c9257d', '43e1415d-439e-4ba2-bcbd-43b50aae076a', '2bc0a497-3fcf-466e-91af-5cafe38b5456', \
20
                    '2592d47c-426c-45d1-9c5d-e97aafff8bff', '1ec4c0c1-5430-43d8-a6ae-e6d5603b31c5', '1bf84e1e-aa91-4f90-82f7-ae7d56fba9fd', \
21
                    '18fcfb0d-1529-4cdf-a94f-47edab607bc2', '12bb5341-2038-44e7-b8d7-1d55be426bb2', '10c7e8e1-dd25-47f2-b691-71192693a12d', \
22
                    '0a4f828f-68c1-486c-83b9-4be49a443135', '07a5abbd-88d5-460f-89bc-7bb7cedc9746', '0547c696-1963-44c2-9eba-5100297edd40', \
23
                    '046e4093-9d9c-49f2-bd7c-af9afedf34d3', '03347731-0f96-4be7-b4bd-223d70c67f75', '016da493-0e9d-42d3-b942-5a45cb36335e']
24
    sqls = []
25

    
26
    for index in range(len(drawing_uids)):
27
        drawing_uid = drawing_uids[index]
28
    
29
        sql = []
30
        #sql.append("delete from LINE_DATA_LIST where PNID_NO = '{}'".format(drawing_name))
31
        sql.append("delete from TitleBlockValues where Drawings_UID = '{}'".format(drawing_uid))
32
        sql.append(f"delete from LineNoAttributes where Components_UID in " \
33
                      f"(select UID from Components where Drawings_UID='{drawing_uid}')")
34
        sql.append(f"delete from Attributes where Components_UID in " \
35
                      f"(select UID from Components where Drawings_UID='{drawing_uid}')")
36
        sql.append(f"delete from Associations where Components_UID in " \
37
                      f"(select UID from Components where Drawings_UID='{drawing_uid}')")
38
        sql.append(f"delete from Points where Components_UID in " \
39
                      f"(select UID from Components where Drawings_UID='{drawing_uid}')")
40
        sql.append(f"delete from PipeRunItems where PipeRuns_UID in " \
41
                      f"(select UID from PipeRuns where Drawings_UID='{drawing_uid}')")
42
        sql.append(f"delete from PipeRuns where Drawings_UID='{drawing_uid}'")
43
        sql.append("delete from Components where Drawings_UID='{}'".format(drawing_uid))
44

    
45
        sqls.append("\n".join(sql))
46

    
47
    #print(sqls)
48
    fw = open(sqlPath, 'w', encoding='utf8')
49
    fw.write("\n\n".join(sqls))
50
    fw.close()
51

    
52

    
53
if __name__ == '__main__':
54
    selection = input("select fuction(clear = 1) : ")
55
    if selection == '1':
56
        make_sql_delete_drawing_data()
클립보드 이미지 추가 (최대 크기: 500 MB)