Skip to content

Conversation

@ashleythomasbarnes
Copy link
Collaborator

New PR from #4 to help @juanmcloaiza for review...

Stripped back now, only query_catalogue and list_catalogues that mirror functionality of other functions included.

@@ -19,7 +19,9 @@ class Conf(_config.ConfigNamespace):
tap_url = _config.ConfigItem(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename tap_url --> tap_obs_url and its explanation as well, so that it is symmetrical with the config entry for catalogues.

row_limit_plus_one = self.ROW_LIMIT + 1

table_with_an_extra_row = tap.search(query=query_str, maxrec=row_limit_plus_one).to_table()
table_with_an_extra_row = tap.search(query=query_str,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself: Either this 4-lines change 1) has no effect; 2) is wrong; or 3) the previous code is wrong. Double check...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashleythomasbarnes, you can safely discard these changes (i.e. keep the original code). Explanation:

The proposed code change has no effect. It seems that the AI didn't understand the purpose of the if clause, and it was natural for it to turn it into a if...else clause.

The original if clause is only a safeguard against increasing an infinite row limit. It was introduced to fix a bug appearing when the user set ROW_LIMIT = 0. If we want to sound very mathematically elegant, we can say that it simply derives from the fact that ∞ +1 = ∞

)

log.debug(f"Querying from {self._tap_url()}")
tap_url = self._tap_url() if which_tap == "tap_obs" else conf.tap_cat_url
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here... This is another instance of the situation not being symmetrical between tap_cat and tap_obs: One is read from self._tap_url(); the other from the config directly. It is OK to have tap_obs set as a default, but for the rest tap_cat and tap_obs should be symmetrical. Do we have a good argument for them NOT being treated the same?

f"\nNumber of records present in the table {table_name}:\n{num_records}\n")

@unlimited_maxrec
@deprecated_renamed_argument('cache', None, since='0.4.12')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for deprecating anything here, since it is a new function. We can remove the cache argument.

_ = cache # We're aware about disregarding the argument
schema = _EsoNames.catalogue_schema

query_str = (f"SELECT table_name FROM TAP_SCHEMA.tables as ref "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself - double check the queries of this function with Alberto

from dataclasses import dataclass
from typing import Dict, List, Optional, Union

import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy is not used. This line should be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Four tests are failing:

  • test_list_catalogues_returns_table
  • test_query_catalogues_unknown_collection_raises
  • test_query_catalogues_help_returns_table
  • test_query_catalogues_cone_uses_ucd_columns

(https://github.com/eso/astroquery/actions/runs/21284643923/job/61262678496)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants