mirror of
https://github.com/apache/superset.git
synced 2026-04-07 18:35:15 +00:00
add lru cache to property
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
"""A collection of ORM sqlalchemy models for SQL Lab"""
|
||||
import re
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import simplejson as json
|
||||
@@ -204,6 +205,7 @@ class SavedQuery(Model, AuditMixinNullable, ExtraJSONMixin):
|
||||
return "/superset/sqllab?savedQueryId={0}".format(self.id)
|
||||
|
||||
@property
|
||||
@lru_cache(maxsize=2)
|
||||
def sql_tables(self) -> List[Table]:
|
||||
return list(ParsedQuery(self.sql).tables)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user