Skip to content

Commit cf7d2a7

Browse files
authored
Merge pull request #2970 from esdc-esac-esa-int/ESA_gaia_include_table_size_in_TapTableMeta
GAIA: include table size in the class TapTableMeta
2 parents 5f54ec6 + 04fb9cc commit cf7d2a7

File tree

6 files changed

+1346
-11
lines changed

6 files changed

+1346
-11
lines changed

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ utils.tap
2424
dot. ``ValueError`` is now raised for such cases. [#2971]
2525

2626

27+
gaia
28+
^^^^
29+
30+
- Include table size in the class TapTableMeta returned by the functions load_tables and load_table, in the class Tap.
31+
[#2970]
32+
33+
2734
0.4.7 (2024-03-08)
2835
==================
2936

@@ -219,6 +226,7 @@ gaia
219226

220227
- Default Gaia catalog updated to DR3. [#2596]
221228

229+
222230
heasarc
223231
^^^^^^^
224232

astroquery/utils/tap/core.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def __internalInit(self):
143143
self.tap_client_id = f"aqtappy1-{VERSION}"
144144

145145
def load_tables(self, *, verbose=False):
146-
"""Loads all public tables
146+
"""Loads all public table metadata. If the user is logged in, it also returns metadata for those tables in the
147+
user's private area.
147148
148149
Parameters
149150
----------
@@ -152,12 +153,13 @@ def load_tables(self, *, verbose=False):
152153
153154
Returns
154155
-------
155-
A list of table objects
156+
A list of TapTableMeta objects
156157
"""
157158
return self.__load_tables(verbose=verbose)
158159

159160
def load_table(self, table, *, verbose=False):
160-
"""Loads the specified table
161+
"""Loads the table metadata, for the specified table. If the user is logged in, the table can refer to a
162+
table in the user's private area.
161163
162164
Parameters
163165
----------
@@ -168,7 +170,7 @@ def load_table(self, table, *, verbose=False):
168170
169171
Returns
170172
-------
171-
A table object
173+
A TapTableMeta object
172174
"""
173175
if table is None:
174176
raise ValueError("Table name is required")

astroquery/utils/tap/model/taptable.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(self):
2727
self.name = None
2828
self.schema = None
2929
self.description = None
30+
self.size_bytes = 0
3031

3132
def get_qualified_name(self):
3233
"""Returns the qualified TAP table name. I.e. schema+table
@@ -35,6 +36,9 @@ def get_qualified_name(self):
3536
-------
3637
The the qualified TAP table name (schema+table)
3738
"""
39+
if '.' in self.name:
40+
return self.name
41+
3842
return f"{self.schema}.{self.name}"
3943

4044
def add_column(self, tap_column):
@@ -50,4 +54,5 @@ def add_column(self, tap_column):
5054
def __str__(self):
5155
return f"TAP Table name: {self.get_qualified_name()}" \
5256
f"\nDescription: {self.description}" \
57+
f"\nSize (bytes): {self.size_bytes}" \
5358
f"\nNum. columns: {len(self.columns)}"

astroquery/utils/tap/xmlparser/tableSaxParser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import xml.sax
1919

20-
from astroquery.utils.tap.model.taptable import TapTableMeta
2120
from astroquery.utils.tap.model.tapcolumn import TapColumn
21+
from astroquery.utils.tap.model.taptable import TapTableMeta
2222
from astroquery.utils.tap.xmlparser import utils as Utils
2323

2424
READING_SCHEMA = 10
@@ -94,6 +94,8 @@ def __reading_schema(self, name, attrs):
9494
self.__status = READING_TABLE
9595
self.__currentTable = TapTableMeta()
9696
self.__currentTable.schema = self.__currentSchemaName
97+
if 'esatapplus:size_bytes' in attrs:
98+
self.__currentTable.size_bytes = int(attrs.getValue('esatapplus:size_bytes'))
9799

98100
def __end_schema(self, name):
99101
if self.__check_item_id("name", name):

0 commit comments

Comments
 (0)