Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for VODataService 1.2 table/@nrows. #503

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

- TAP examples now support the continuation property [#483]

- Adding support for the VODataService 1.2 nrows attribute on table
elements [#503]


1.4.3 (unreleased)
==================
Expand Down
1 change: 1 addition & 0 deletions pyvo/io/vosi/tests/data/tables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>Test table</title>
<description>All test data in one table</description>
<utype>utype</utype>
<nrows>30</nrows>
<column>
<name>id</name>
<description>Primary key</description>
Expand Down
1 change: 1 addition & 0 deletions pyvo/io/vosi/tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_all(self):
assert table.title == "Test table"
assert table.description == "All test data in one table"
assert table.utype == "utype"
assert table.nrows==30
bsipocz marked this conversation as resolved.
Show resolved Hide resolved

col = table.columns[0]
fkc = table.foreignkeys[0]
Expand Down
15 changes: 15 additions & 0 deletions pyvo/io/vosi/vodataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def __init__(
self._utype = None
self._type = kwargs.get("type")
self._version = version
self._nrows = None

self._columns = HomogeneousList(TableParam)
self._foreignkeys = HomogeneousList(ForeignKey)
Expand Down Expand Up @@ -383,6 +384,20 @@ def utype(self):
def utype(self, utype):
self._utype = utype

@xmlelement(plain=True, multiple_exc=W09)
def nrows(self):
"""
the approximate number of rows in the table.

This is None if the data provider failed to provide this
information.
"""
return self._nrows

@nrows.setter
def nrows(self, nrows):
self._nrows = int(nrows)

@xmlattribute
def type(self):
"""
Expand Down
Loading