Is there a way to directly access any of the Sloan Digital Sky Survey servers via SQL via Python?

Currently I have been able to run SQL queries from the website they provide (for example https://skyserver.sdss.org/dr12/en/tools/search/sql.aspx), but it's not clear to me how I can access them directly from a Python interface.

Any suggestions what connection details I would need to use are highly appreciated.

  • $\begingroup$ I’d be surprised—that would imply giving out their password, potentially opening the door to malignant users. Granted, it wouldn’t be the main password, and it would have restricted privileges, but it would still be a potentially dangerous practice. $\endgroup$ Commented Apr 4, 2021 at 2:46

1 Answer 1


You can do it via the astroquery SDSS module; there is a function called query_sql.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .