Announcement

Collapse
No announcement yet.

Processing the results of a data compare

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Processing the results of a data compare

    I am working with two databases, which are about 95% identical in terms of their schema. I have scripted all their DB objects into two folders, A and B. I would now like to use Beyond Compare to tell me which objects are identical between A and B, and pull them out into a third folder, C. The result of this would be that when A + C would be sufficient to build Database A, while B + C would be sufficient to build Database B, and A and B would hold the differences between the two.

    How easy is it to script Beyond Compare so that I can process the results of a folder compare?

  • #2
    Hello,

    Could C consist of entire files or a report of the differences between files?

    Before scripting, I suggest using the graphical interface, which provides more feedback and allows quicker configuration changes to get the comparison you need. Once that workflow is working, script does support many of the commands found in the Folder Compare interface.

    It sounds a bit like you should start with a Folder Compare session, and load FolderA and FolderB on the left and right side. You can then scan these files for differences: the default is a timestamp/size comparison, or you can run a rules-based scan or binary scan on the content.

    From there, you can set the Display Filters to Show Same, Edit menu -> Expand All, Edit menu -> Select All Files, and Copy To Folder, which allows a FolderC target of the selection of different files. You can then use the Edit menu -> Invert Selection, and Shift+Arrow Keys to select only FolderA, and Copy to Folder to create a clone of just the non-C items, and repeat Shift+ArrowKeys to slide the selection to FolderB and Copy To Folder for a clone of FolderB's Not C items. This leaves you with OriginalA, OriginalB, NewA, NewB, and NewC. You could also use the Move to Folder command, but I suggest working with test data first or creating copies, before altering the original data set, while learning the application.

    Loading folders, expanding, selecting same, and move to folder are all available as script commands, assuming this is the workflow you are looking for.

    The trial is fully featured, so you can test before purchase is necessary and let us know if you have any questions. I would suggest working with test data first, since BC4 does not support an UNDO command (in the graphical or scripting interface) and script does not preview the comparison before committing actions.
    Aaron P Scooter Software

    Comment


    • #3
      Hi Aaron,

      Thanks for your help; by following your suggested steps, I was able to separate out the folders as I wanted through the UI. My script so far is looking like this:

      LOAD <default>
      FILTER *.sql
      LOAD A B
      CRITERIA rules-based
      EXPAND ALL
      SELECT ALL
      COPYTO LEFT path:base C
      DELETE ALL

      which I'm hoping will leave me with A and B containing just the differences, and C containing the commonalities. Does it look like I'm heading in the right direction?

      Comment


      • #4
        Hello,

        The Select command in script is what determines if same/different/etc is selected, so you'll want to select same rather than all.

        **I would also highly recommend testing with test folders first, as the delete won't preview before committing and cannot be Undone. You can add an option to try and use the recycle bin, but this is ultimately under the control of Windows if it puts the files in, and isn't a guarantee of a backup.**

        Review the Log after run to verify the files you expect were all copied into C, and then deleted from A and B.

        You can also clean up the script a little by reordering commands. For example, if you set criteria before a folder load, then the criteria is used during the load. Otherwise, it loads and compares (just like the interface), then updating the criteria triggers the compare again. It's not too expensive for the default timestamp/size load first, but you can save a little time.

        FILTER *.sql
        CRITERIA rules-based
        LOAD c:\temp\A c:\temp\B
        EXPAND ALL
        SELECT left.exact.files
        COPYTO LEFT path:base c:\temp\C
        Select left.exact files right.exact.files
        DELETE ALL
        Aaron P Scooter Software

        Comment

        Working...
        X