data-diff

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  DiffDog Client Command Line >

data-diff

The data-diff command runs one or more database data comparison jobs configured previously. By default, the comparison result is displayed at the command line in XML format. You can control the output kind (text, XML) by setting the output-mode option from the configuration file. The path of the output file is set from either the client-output-path or server-output-path options. For more information about setting up database comparison jobs, see Comparing Database Data.

 

To get the comparison outcome as a numeric value, check the value of the %ERRORLEVEL% environment variable after running this command. The possible values are:

 

Error level

Meaning

0

No differences exist

1

Differences exist

2

An error has occurred

 

Syntax

DiffDogCmdlClient data-diff [options] {job} ...

 

Where job refers to a [datadiff] section defined in the client configuration file. You can specify the job argument more than once in order to run multiple database comparison jobs in one run of the command.

 

On Linux, use an all-lowercase to call the executable. In addition, on Linux and macOS, you might need to add the prefix "./" before the name of the executable when calling it from the current directory of the command shell.

 

This command can also be called using the compare-data alias. You can use compare-data and data-diff interchangeably.

 

Options

The options applicable to the data-diff command are listed below.

 

--config, --c

This option specifies the path to a configuration file where the <named_datadiff> was defined.

 

If you do not set the --c option, the DiffDog Command Line Client executable attempts to read the client configuration file from the same directory. If there is no configuration file in the same directory as the executable, the default values as described in the command line help and this documentation apply.

 

--port

This option specifies the port on which DiffDog Server listens for requests. Setting this option is meaningful if DiffDog Server runs on a port other than the default 29800. As an alternative to setting this option at the command line, you can set it in the Client Configuration File. Note that, if you set this value at the command line, it takes precedence over the one defined in the configuration file.

 

--quiet, --q

Prevents the standard output from being displayed at the command line. Valid values:

 

true

Do not display standard output in the terminal window.

false

(Default) Display standard output in the terminal window.

 

--server

This option specifies the server address on which DiffDog Server listens for requests. Setting this option is meaningful if DiffDog Server runs on a server other than the default localhost. As an alternative to setting this option at the command line, you can set it in the Client Configuration File. Note that, if you set this value at the command line, it takes precedence over the one defined in the configuration file.

 

Example

The following command runs a single database data comparison job called "reports".

 

DiffDogCmdlClient data-diff reports

 

It is assumed that the client configuration file contains a [datadiff:reports] section, for example:

 

[datasource:left_data]
type = sqlite
path = c:\comparisons\db\Nanonull_Left.sqlite
table = "main"."products"
 
[datasource:right_data]
type = adonet

connection = Data Source=SQLSERV16;Initial Catalog=NANONULL;MultipleActiveResultSets=True;Password=7hiu57;Persist Security Info=True;User ID=altova

assembly = System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

class = System.Data.SqlClient

table = [NANONULL].[dbo].[PRODUCTS]
 
[datadiff:reports]
left = left_data
right = right_data
map = 1 => 1, 2 => 2, 3 => 3

output-mode=text

client-output-path=c:\comparisons\db\result.txt

 

In the configuration file above, the [datasource:left_data] and [datasource:right_data] are two data sources that provide data for the left and right side of the comparison. The left_data points to table "products" from a local SQLite database. The right_data points to table "PRODUCTS" of a SQL Server database. Both tables have a primary key, so it is not necessary to specify a key column using the option key-column-by-name.

 

The [datadiff:reports] section sets both data sources above as the left and right side of the comparison. In addition, it maps the columns that are to be compared. In this example, the first, second, and third columns from the left are mapped with the first, second, and third columns from the right, respectively. The comparison result is set to be in text format and it will be saved to a local text file.

 

This is not an exhaustive list of options; for reference to all the options you can define in a data source, see Setting up Data Sources. For options you can define in a database comparison job, see Setting up Database Comparisons.


© 2019 Altova GmbH