Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-820

Simplify copying tables while adding columns

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Won't Fix
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
      None
    • Story Points:
      4
    • Team:
      Data Release Production

      Description

      Currently, if I want to copy a table while adding a few columns (as specified by schema in the example) I need to do something like:

              cat = afwTable.SourceCatalog(schema)
              cat.table.defineCentroid(srcCat.table.getCentroidDefinition())
              cat.table.definePsfFlux(srcCat.table.getPsfFluxDefinition())
              # etc.
       
              scm = afwTable.SchemaMapper(srcCat.getSchema(), schema)
              for schEl in srcCat.getSchema():
                  scm.addMapping(schEl.getKey(), True)
       
              cat.extend(srcCat, True, scm)

      Please make this easier! For example

      • by adding a flag to the SchemaMapper constructor that automatically does the addMapping (should this be the default?)
      • by making it possible to copy all the slots (maybe this'll be the case when the new alias scheme is implemented?).

      Maybe we just need a new method:

      cat = srcCat.extend(schema)

      that does all the above steps.

        Attachments

          Issue Links

            Activity

            rhl Robert Lupton created issue -
            swinbank John Swinbank made changes -
            Field Original Value New Value
            Team Princeton [ 10301 ]
            swinbank John Swinbank made changes -
            Issue Type Story [ 10001 ] Improvement [ 4 ]
            swinbank John Swinbank made changes -
            Story Points 4
            swinbank John Swinbank made changes -
            Rank Ranked higher
            swinbank John Swinbank made changes -
            Link This issue relates to DM-2298 [ DM-2298 ]
            swinbank John Swinbank made changes -
            Rank Ranked lower
            gcomoretto Gabriele Comoretto made changes -
            Remote Link This issue links to "Page (Confluence)" [ 20136 ]
            swinbank John Swinbank made changes -
            Resolution Done [ 10000 ]
            Status To Do [ 10001 ] Won't Fix [ 10405 ]

              People

              Assignee:
              jbosch Jim Bosch
              Reporter:
              rhl Robert Lupton
              Watchers:
              Jim Bosch, John Swinbank, Robert Lupton
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: