DALResults¶
-
class
pyvo.dal.query.
DALResults
(votable, url=None)[source]¶ Bases:
object
Results from a DAL query. It provides random access to records in the response. Alternatively, it can provide results via a Cursor (compliant with the Python Database API) or an iterable.
initialize the cursor. This constructor is not typically called by directly applications; rather an instance is obtained from calling a DALQuery’s execute().
Parameters: votable : str
the service response parsed into an astropy.io.votable.tree.VOTableFile instance.
url : str
the URL that produced the response
Raises: DALFormatError
if the response VOTable does not contain a response table
See also
Attributes Summary
fielddescs
return the full metadata the columns as a list of Field instances, fieldnames
return the names of the columns. These are the names that are used queryurl
the URL query that produced these results. None is returned if unknown table
the astropy table object Methods Summary
cursor
()return a cursor that is compliant with the Python Database API’s fieldname_with_ucd
(ucd)return the field name that has a given UCD value or None if the UCD fieldname_with_utype
(utype)return the field name that has a given UType value or None if the UType getcolumn
(name)return a numpy array containing the values for the column with the getdesc
(name)return the field description for the record attribute (column) with getrecord
(index)return a representation of a result record that follows dictionary getvalue
(name, index)return the value of a record attribute–a value from a column and row. Attributes Documentation
-
fielddescs
¶ return the full metadata the columns as a list of Field instances, a simple object with attributes corresponding the the VOTable FIELD attributes, namely: name, id, type, ucd, utype, arraysize, description
-
fieldnames
¶ return the names of the columns. These are the names that are used to access values from the dictionaries returned by getrecord(). They correspond to the column name.
-
queryurl
¶ the URL query that produced these results. None is returned if unknown
-
table
¶ the astropy table object
Methods Documentation
-
cursor
()[source]¶ return a cursor that is compliant with the Python Database API’s
Cursor
interface. See PEP 249 for details.
-
fieldname_with_ucd
(ucd)[source]¶ return the field name that has a given UCD value or None if the UCD is not found.
-
fieldname_with_utype
(utype)[source]¶ return the field name that has a given UType value or None if the UType is not found.
-
getcolumn
(name)[source]¶ return a numpy array containing the values for the column with the given name
-
getdesc
(name)[source]¶ return the field description for the record attribute (column) with the given name
Parameters: name : str
the name of the attribute (column), chosen from those in fieldnames()
Returns: object
with attributes (name, id, datatype, unit, ucd, utype, arraysize) which describe the column
-
getrecord
(index)[source]¶ return a representation of a result record that follows dictionary semantics. The keys of the dictionary are those returned by this instance’s fieldnames attribute.The returned record may have additional accessor methods for getting at stardard DAL response metadata (e.g. ra, dec).
Parameters: index : int
the integer index of the desired record where 0 returns the first record
Returns: Record
a dictionary-like wrapper containing the result record metadata.
Raises: IndexError
if index is negative or equal or larger than the number of rows in the result table.
See also
-
getvalue
(name, index)[source]¶ return the value of a record attribute–a value from a column and row.
Parameters: name : str
the name of the attribute (column)
index : int
the zero-based index of the record
Raises: IndexError
if index is negative or equal or larger than the number of rows in the result table.
KeyError
if name is not a recognized column name
-