(Apologies if I’m doing this wrong, first time)
Hi,
I have a query which is (I think) only a small change from one of the tutorials and it isn’t working. I was just trying to add two columns from the dp1.Source table to combine with the dp1.ForcedSourceOnDiaObject table.
Here is the problem query:
query = (
"SELECT fsodo.coord_ra, fsodo.coord_dec, fsodo.diaObjectId, fsodo.visit, fsodo.detector, fsodo.band, vis.skyRotation, "
"fsodo.tract, fsodo.patch, fsodo.psfDiffFlux, fsodo.psfDiffFluxErr, fsodo.psfFlux, fsodo.psfFluxErr, vis.expMidptMJD, "
"src.x, src.y "
"FROM dp1.ForcedSourceOnDiaObject as fsodo "
"JOIN dp1.Visit as vis ON vis.visit = fsodo.visit "
"JOIN dp1.Source as src ON src.visit = fsodo.visit "
f"WHERE fsodo.diaObjectId = {diaobjectid}"
)
The resulting error is:
DALQueryError Traceback (most recent call last)
Cell In[7], line 15
13 job.wait(phases=["COMPLETED", "ERROR"])
14 print("Job phase is", job.phase)
---> 15 job.raise_if_error()
16 assert job.phase == "COMPLETED"
18 df_exposure = job.fetch_result().to_table()
File /opt/lsst/software/stack/conda/envs/lsst-scipipe-10.1.0/lib/python3.12/site-packages/pyvo/dal/tap.py:1018, in AsyncTAPJob.raise_if_error(self)
1016 msg = self._job.errorsummary.message.content
1017 msg = msg or "<No useful error from server>"
-> 1018 raise DALQueryError("Query Error: " + msg, self.url)
DALQueryError: Query Error: Qserv request failed: QI=?: Failed to instantiate query: AnalysisError:Query involves partitioned table joins that Qserv does not know how to evaluate using only partition-local data
Which makes me think that the dp1.Source table is hosted in a different place than the other tables so it can’t be joined? I’m really not sure, I’m very new to this.
For comparison, this query works just fine:
query = (
"SELECT fsodo.coord_ra, fsodo.coord_dec, fsodo.diaObjectId, fsodo.visit, fsodo.detector, fsodo.band, vis.skyRotation, "
"fsodo.tract, fsodo.patch, fsodo.psfDiffFlux, fsodo.psfDiffFluxErr, fsodo.psfFlux, fsodo.psfFluxErr, vis.expMidptMJD "
"FROM dp1.ForcedSourceOnDiaObject as fsodo "
"JOIN dp1.Visit as vis ON vis.visit = fsodo.visit "
f"WHERE fsodo.diaObjectId = {diaobjectid}"
)
This isn’t an issue with joining 3 tables, since I can remove the dp1.Visit columns/JOIN and I still get the same error.
I’m sure I’m doing something wrong, but what I know about SQL and these tables based on the schema says that this should have worked.
Best,
Connor