Uploaded image for project: 'Instrument control development'
  1. Instrument control development
  2. INSTRM-1762

current agc_exposure table does not match defined constraints.

    XMLWordPrintable

    Details

    • Story Points:
      2

      Description

      I've bumped into this a few time running alembic on the current summit opdb.
      So basically, models.py declare there is a contraint between pfs_visit.pfs_visit_id and agc_exposure_visit_id.

      So, that you cannot insert on a pfs_visit_id that does not exist.
      This is the right thing to do but, but right now, on the current instance, there is no constraint, so agc_visit.pfs_visit_id can take whatever value, erk...

      I cannot easily add the contraint because there is pfs_visit_id in agc_exposure which does not exist in pfs_visit table :

      set(agc[:,1]) - set(pfs[:,0])
         {0, 99999, 779594}
      

      From what I understand, cloomis, agc_exposure does not necessarily have a valid pfs_visit, so it's set to 0 in that case, which is fine and we could add that "fake" pfs_visit_id into pfs_visit to respect the constraint. but 99999, 779594 are valid pfs_visit_id and those will eventually exist causing troubles.

      Fixing the issue boils down to basically 3 things to do :

      1. setting pfs_visit_id to 0 where pfs_visit_id==99999 or 779594
      2. adding a row in pfs_visit where pfs_visit_id=0
      3. adding the contraint between agc_exposure.pfs_visit_id and pfs_visit.pfs_visit_id

        Attachments

          Activity

            People

            • Assignee:
              arnaud.lefur arnaud.lefur
              Reporter:
              arnaud.lefur arnaud.lefur
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: