Merge pull request #24410 from ankush/perf_fieldname

perf: cache fieldname extraction
This commit is contained in:
Ankush Menat 2024-01-17 12:06:55 +05:30 committed by GitHub
commit cf2be9d64e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@
"""build query for doclistview and return results"""
import json
from functools import lru_cache
from sql_metadata import Parser
@ -178,6 +179,7 @@ def is_standard(fieldname):
)
@lru_cache
def extract_fieldnames(field):
parser = Parser(f"select {field}, _frappe_dummy from _dummy")
columns = [col for col in parser.columns if col != "_frappe_dummy"]