-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
In order to query text fields using PDSC, we want to add support for like comparator in the query() function of PdsClient class.
Lines 141 to 173 in 74893bb
| def query(self, instrument, conditions=None): | |
| """ | |
| Supports a generic query of observations based on metadata | |
| :param instrument: | |
| PDSC instrument name | |
| :param conditions: | |
| a collection of tuples indicating query constraints; each tuple | |
| should contain three entries: | |
| - metadata variable name | |
| - comparator (``'='``, ``'<'``, ``'>'``, ``'<='``, ``'>='``) | |
| - value | |
| A SQL-like query will be performed with a logical AND of the | |
| specified conditions | |
| :return: a list of :py:class:`~pdsc.metata.PdsMetadata` objects | |
| corresponding to observations matching the specified query | |
| conditions | |
| >>> import pdsc | |
| >>> client = pdsc.PdsClient() | |
| >>> metadata = client.query('hirise_rdr', [ | |
| ... ('corner1_latitude', '>', -0.5), | |
| ... ('corner1_latitude', '<', 0.5) | |
| ... ]) | |
| .. Warning:: | |
| This function currently assumes non-adversarial inputs; the current | |
| implementation allows a potential SQL injection attack. | |
| """ |
Metadata
Metadata
Assignees
Labels
No labels