Skip to content

Commit

Permalink
add lru cache to property
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar committed Sep 10, 2020
1 parent 009bcff commit ad0d942
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superset/models/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -204,6 +205,7 @@ def url(self) -> str:
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)

Expand Down

0 comments on commit ad0d942

Please sign in to comment.