LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Variables
lsst.ap.SqlStoreOutputs Namespace Reference

Variables

list mysqlStatements
 
dictionary sqlStatements = { 'mysql': mysqlStatements }
 

Variable Documentation

list lsst.ap.SqlStoreOutputs.mysqlStatements
Initial value:
1 = [
2  # Set objectId of each difference source to the id of the closest matching object
3  """CREATE TEMPORARY TABLE _tmp_v%(visitId)d_BestMatch LIKE _tmpl_InMemoryMatchPair""",
4  """ALTER TABLE _tmp_v%(visitId)d_DIASourceToObjectMatches ADD INDEX (first, distance)""",
5  """INSERT INTO _tmp_v%(visitId)d_BestMatch SELECT a.first, a.second, a.distance FROM _tmp_v%(visitId)d_DIASourceToObjectMatches AS a LEFT OUTER JOIN _tmp_v%(visitId)d_DIASourceToObjectMatches AS b ON a.first = b.first AND (b.distance < a.distance OR (b.distance = a.distance AND b.second < a.second)) WHERE b.first IS NULL""",
6  """UPDATE _tmp_v%(visitId)d_DIASource AS s, _tmp_v%(visitId)d_BestMatch AS m SET s.objectId = m.second WHERE s.diaSourceId = m.first""",
7  # Set objectId of each difference source used to create an object
8  """UPDATE _tmp_v%(visitId)d_DIASource AS s, _tmp_v%(visitId)d_DIASourceToNewObject AS n SET s.objectId = n.second WHERE s.diaSourceId = n.first""",
9  # Set id of sibling difference source (measured on other exposure in visit)
10  """UPDATE _tmp_v%(visitId)d_DIASource SET diaSourceToId = diaSourceId ^ (1 << 14)""",
11  # Append difference sources to the historical DiaSource table
12  """INSERT INTO %(diaSourceTable)s SELECT * FROM _tmp_v%(visitId)d_DIASource""",
13  # Update latest observation time and observation count for objects with matches
14  """UPDATE %(varObjectTable)s AS o, _tmp_v%(visitId)d_BestMatch AS m SET o.latestObsT = '%(dateObs)s', o.%(filter)cNumObs = o.%(filter)cNumObs + 1 WHERE o.objectId = m.second""",
15  """UPDATE %(nonVarObjectTable)s AS o, _tmp_v%(visitId)d_BestMatch AS m SET o.latestObsT = '%(dateObs)s', o.%(filter)cNumObs = o.%(filter)cNumObs + 1 WHERE o.objectId = m.second""",
16  # Create new objects from difference sources in an in-memory table.
17  """CREATE TEMPORARY TABLE _tmp_v%(visitId)d_NewObject LIKE _tmpl_InMemoryObject""",
18  # Insert records (all filter-specific fields set to NULL)
19  """INSERT INTO _tmp_v%(visitId)d_NewObject SELECT n.second, # objectId s.ra, # ra s.decl, # decl '%(dateObs)s', # earliestObsT '%(dateObs)s', # latestObsT NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL FROM _tmp_v%(visitId)d_DIASourceToNewObject AS n JOIN _tmp_v%(visitId)d_DIASource AS s ON (s.diaSourceId = n.first)""",
20  # Set filter specific fields in the in-memory temp table
21  # FIXME: copying flux values into magnitudes is clearly bogus
22  """UPDATE _tmp_v%(visitId)d_NewObject AS o, _tmp_v%(visitId)d_DIASourceToNewObject AS n, _tmp_v%(visitId)d_DIASource AS s SET o.%(filter)cMag = s.psfFlux, o.%(filter)cMagErr = s.psfFluxErr, o.%(filter)cIxx = s.Ixx, o.%(filter)cIyy = s.Iyy, o.%(filter)cIxy = s.Ixy, o.%(filter)cNumObs = 1 WHERE o.objectId = n.second AND n.first = s.diaSourceId""",
23  # Append the in-memory temp table to the variable object catalog
24  """INSERT INTO %(varObjectTable)s SELECT * FROM _tmp_v%(visitId)d_NewObject"""
25 ]

Definition at line 28 of file SqlStoreOutputs.py.

dictionary lsst.ap.SqlStoreOutputs.sqlStatements = { 'mysql': mysqlStatements }

Definition at line 93 of file SqlStoreOutputs.py.