Skip to content

Commit 5f5abe0

Browse files
committed
Cache TAP tables
1 parent a89674d commit 5f5abe0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

astroquery/esasky/core.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class ESASkyClass(BaseQuery):
7272
_MAPS_DOWNLOAD_DIR = "Maps"
7373
_SPECTRA_DOWNLOAD_DIR = "Spectra"
7474
_isTest = ""
75+
_cached_tables = None
7576

7677
_NUMBER_DATA_TYPES = ["REAL", "float", "INTEGER", "int", "BIGINT", "long", "DOUBLE", "double", "SMALLINT", "short"]
7778

@@ -111,7 +112,7 @@ def query(self, query, *, output_file=None, output_format="votable", verbose=Fal
111112
dump_to_file=output_file is not None)
112113
return job.get_results()
113114

114-
def get_tables(self, *, only_names=True, verbose=False):
115+
def get_tables(self, *, only_names=True, verbose=False, cache=True):
115116
"""
116117
Get the available table in ESASky TAP service
117118
@@ -126,10 +127,13 @@ def get_tables(self, *, only_names=True, verbose=False):
126127
-------
127128
A list of tables
128129
"""
129-
130-
tables = self._tap.load_tables(only_names=only_names,
131-
include_shared_tables=False,
132-
verbose=verbose)
130+
131+
if cache and self._cached_tables is not None:
132+
tables = self._cached_tables
133+
else:
134+
tables = self._tap.load_tables(only_names=only_names,
135+
include_shared_tables=False,
136+
verbose=verbose)
133137
if only_names:
134138
return [t.name for t in tables]
135139
else:

0 commit comments

Comments
 (0)