Column configuration file for DataDiff
The purpose of the column configuration file is to avoid specifying key columns
and/or ignored columns on every data comparison.
You can set path to a column configuration file in the Options dialog as shown on the screenshots.
Then on each data comparison DataDiff will read the file and apply the settings found there to the
columns of the compared tables. As the result, certain columns may be marked as ignored ones, as
compared ones or as keys.
The built-in editor. The options dialog provides a very simple way to edit the column
configuration file without using an external editor. Whenever you choose a filename, the file
is scanned and all [Ignore], [Compare] and [Keys] rules are displayed in the 3 columns. You can then
edit them and save them back to file. Please note that the contents of these three edit boxes are not
automatically saved to the file nor cached in memory. Once you close the Options dialog, the file
name is remembered, but any changes you might have done to the rules will be lost, unless you have
explicitly saved them.
Also note that if your configuration file has been created manually and contains repeated sections,
or the order of sections is important (like in the example shown above), you must continue
using an external editor and should not use the Save button, as it will overwrite your design,
writing all the rules into 3 sections in a predefined order.
The column configuration is kept in a text file whose format is similar to
an INI file. It may contain section headers, column patterns and comments.
Section headers are lines which only contain
"[Ignore]", "[Compare]" or "[Keys]. There can be multiple
sections in the file and sections with the same name can be repeated.
Each column pattern is matched against each column in the compared tables to decide
if this column's role in the comparison should be changed according to the section in which
the pattern is located. This means that any pattern or a group of them must be preceded by a section header
(in other words, the file must start with a section header). The column patterns can contain
three optional parts - table name, column name and column type:
[ [[*]table_name.] [*]column_name] : [*]column_type
If a table name is supplied, any further processing of this pattern only takes place
if it matches names of the tables being compared. It may happen that the compared tables
have different names, in which case only columns of the matching table will be
processed with the rule. If no table name is specified in the pattern, it will be processed
for any table comparison.
At least one of the column_name or column_type must be specified. The program
compares them against names and/or types of each column in the comparison. If both name
and type are specified, they must both match for the rule to take effect.
The configuration
file does not recognize names enclosed into brackets [] or quotes "" , as MS SQL does. If you
need to specify names containing spaces or other not-alphanumeric characters, put
them into the config file as they are. Names containing '.', ':' or '*' can't
be used in a pattern.
All comparisons are case-insensitive. The program doesn't currently support any form of regexps
in the column configuration file, but if you specify a "*" before any part of the pattern,
it will be treated as a substring, otherwise the check would be for exact match.
For example, ":*int" will match any columns of types "int", "bigint" or "tinyint",
whereas ":int" will affect only "int" columns.
Comments. Any empty lines in the column configuration file are ignored.
Any lines starting with ";" or "#" are considered comments and also ignored. The program
does not recognize comments at the ends of patterns of section headers, any comment
must be contained on its own line.
Precedence. It is possible and likely that the same column will be affected by several
rules. For example, you might tell the program to ignore all BLOB fields except for
those in MyTable, where they all should be compared except for the field "Comment", which must be ignored.
There is no special notation to express the order of precedence, but since the file is processed
sequentially and its sections can be repeated, you can simply arrange more generic rules at the
beginning of the file and the more specific ones closer to the end. For example:
[Ignore]
:blob
[Compare]
MyTable.:blob
[Ignore]
Mytable.Comment
|