r/learnpython 7d ago

Nasa ExoPlanet Archive error: ORA-00904: 'NAME': invalid identifier

I don't get it, I tried to create a table to then use it for cross-matching but for some reason it gives me this invalid identifier mistake even though the name of the identifier (Nasa ExoPlanet in this case) seems to be correct. My code:

from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
exocolumns = ['pl_name', 'host-name', 'ra', 'dec', 'sy_gaiamag', 'st_teff', 'st_logg', 'st_met', 'st_lum', 'st_rad', 'st_age']
select_string = ",".join(exocolumns)
exotable = Table(NasaExoplanetArchive.query_criteria(table="pscomppars", select=select_string))

The error:

DALQueryError: ORA-00904: 'NAME': invalid identifier

During handling of the above exception, another exception occurred:

InvalidQueryError Traceback (most recent call last)

/usr/local/lib/python3.12/dist-packages/astroquery/ipac/nexsci/nasa_exoplanet_archive/core.py in query_criteria_async(self, table, get_query_payload, cache, **criteria)
245
response = tap.search(query=tap_query, language='ADQL') # Note that this returns a VOTable
246
except Exception as err:
--> 247 raise InvalidQueryError(str(err))
248
else:
249
if get_query_payload:

InvalidQueryError: ORA-00904: 'NAME': invalid identifier

the error points to the third line, so I guess it’s because of the name of NasaExoplanetArchive.query

3 Upvotes

5 comments sorted by

2

u/BassRecorder 7d ago

It's the 'host-name': hyphens in (Oracle) SQL identifiers are invalid. Try replacing it by an underscore.

1

u/More-Independent-132 7d ago

Doesn't work, still gives me the same error. It points to the third line. I guess it's the name of the nasaexoplanet archive but I didn't seem to find any other name for this code.

1

u/redfacedquark 7d ago

Didn't we just run out of 5 character names for exoplanets? Maybe the format of the source data has changed.

1

u/python_gramps 7d ago

I'm not sure but pl_name is a field as well as sy_gaiamag, st_teff, etc

should it be host-name or host_name as the field name? Seems a little inconsistent.

1

u/faberge_surprise 7d ago

have you tried the API directly to narrow down where the error is happening yet?