개정판 c403835a
export list speed improved
Change-Id: If6f61333177a0a711034a0ee24dd7aecbfac12d3
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
3640 | 3640 |
# Get a cursor object |
3641 | 3641 |
cursor = conn.cursor() |
3642 | 3642 |
|
3643 |
''' |
|
3643 | 3644 |
sql = 'select A.UID,B.Name,A.Value as [Line No] from Components A left join Drawings B on A.Drawings_UID=B.UID' |
3644 | 3645 |
if drawings is not None: |
3645 | 3646 |
doc_names = "','".join(drawings) |
3646 |
sql += f" where Drawings_UID in (select UID from Drawings where Name in ('{doc_names}'))" |
|
3647 |
sql += f" where A.Symbol_UID=1 and Drawings_UID in (select UID from Drawings where Name in ('{doc_names}'))"
|
|
3647 | 3648 |
cursor.execute(sql) |
3648 | 3649 |
comps = [(row['UID'], row['Name'], row['Line No']) for row in cursor.fetchall()] |
3649 | 3650 |
for comp in comps: |
... | ... | |
3659 | 3660 |
data.insert(0, ['UID', comp[0]]) |
3660 | 3661 |
data.insert(0, ['Line No', comp[2]]) |
3661 | 3662 |
result.append(data) |
3663 |
''' |
|
3664 |
|
|
3665 |
sql = 'select A.UID,B.Name,A.Value as [Line No],D.[Name] as AttrN,C.[Value] as [AttrV] from Components A left join Drawings B on A.Drawings_UID=B.UID \ |
|
3666 |
left join LineNoAttributes C on A.[UID]=C.Components_UID left join LineProperties D on C.LineProperties_UID=D.UID' |
|
3667 |
if drawings is not None: |
|
3668 |
doc_names = "','".join(drawings) |
|
3669 |
sql += f" where A.Symbol_UID=1 and Drawings_UID in (select UID from Drawings where Name in ('{doc_names}'))" |
|
3670 |
cursor.execute(sql) |
|
3671 |
|
|
3672 |
comps = [[row['UID'], row['Name'], row['Line No'], row['AttrN'], row['AttrV']] for row in cursor.fetchall()] |
|
3673 |
lineNos = {} |
|
3674 |
|
|
3675 |
for comp in comps: |
|
3676 |
if comp[0] not in lineNos: |
|
3677 |
lineNos[comp[0]] = [['Line No', comp[2]], ['UID', comp[0]], ['Drawing Name', comp[1]]] |
|
3678 |
lineNos[comp[0]].append([comp[3], comp[4]]) |
|
3679 |
|
|
3680 |
result = list(lineNos.values()) |
|
3662 | 3681 |
|
3663 | 3682 |
# catch the exception |
3664 | 3683 |
except Exception as ex: |
내보내기 Unified diff