DiffDog Server can compare data that originates from comma-, semicolon-, and tab- separated files (CSV, TSV). Specifically, files that meet the following criteria are eligible for comparison:
•Each line (row) must contain the same number of fields throughout the file. The file extension is not important.
•The field separators must be one of the following: comma, semicolon, and tab.
Since CSV files are in fact tabular data, you can compare them with data from a database table, view, or custom recordset.
Comparing CSV files in DiffDog Server works in the same way as database comparisons. Namely, you set up the comparison job by editing the DiffDog Server .ini files. An alternative approach, supported only on Windows, is to create the comparison jobs from the graphical user interface of DiffDog Enterprise desktop application, save them as .dbdif files, and then run them on the server. Both approaches are described in more detail below.
Setting up a comparison job in DiffDog Server involves the following steps:
1.Add a data source that represents the "left" side of comparison to the configuration file. This can be done in either the client or the server configuration file. For CSV files, a typical data source could look as shown below. For more information about the possible keys and their meaning, see Setting up Data Sources.
2.Add the second data source (the "right" side of the comparison).
3.Add a data comparison job where you indicate what is the left and right data source, the columns to be compared, and other parameters. The map option lets you specify which columns take part in the comparison (the first and second columns, in this example).
In this example, the output of the CSV comparison is reported as XML, as shown by the output-mode=xml option. Another option is output-mode=text. If the right side of the comparison is a database, you can also use output-mode=sql, and in this way you can obtain SQL scripts to merge data from the left to the right side. By default, the report is displayed at the command line, but you can optionally redirect it to a file, by adding the client-output-path option:
For more information, see Setting up CSV and Database Comparisons.
4.Call the executable and run the data-diff command. In the code listing below, the configuration file is supplied using the --c option and the job name is supplied as argument:
exec data-diff --c=client_config.ini reports
You can also set or override the output format for the comparison report at the command line, by adding the --output-mode option, for example:
exec data-diff --c=client_config.ini reports --output-mode=xml
To use this approach, a DiffDog Enterprise license is required. Note that this approach is supported only if DiffDog Server runs on Windows, because the comparison .dbdif files created with the DiffDog desktop application store paths using Windows syntax.
To create the comparison job in DiffDog desktop:
1.On the File menu, click Compare Database Data.
2.Using the connection wizard, add a data source for the left and right side of the comparison, respectively. This can be either a database or a CSV file.
3.Add the connections (mappings) between columns that you would like to include in the comparison.
4.Optionally, run the comparison by invoking the Diff and Merge | Start Comparison menu command, or by clicking , or by pressing F5.
5.On the File menu, click Save, and choose a destination folder for the .dbdif file.
For more information about creating .dbdif files, refer to Altova DiffDog Enterprise documentation (https://www.altova.com/documentation).
On the server side, you can run a .dbdif file by calling the run command of either the server or client executable, for example:
<exec> run <dbdiff-file>
•For the comparison to run successfully, all the CSV file paths that were added on the desktop machine must be valid on the server machine.
•If database connections are involved, the server machine must be configured and capable to handle the connection. For example, if the .dbdif file includes a connection that requires on ODBC driver from the database vendor, that driver must be installed on the server machine as well, see also Supported Databases.