|
The "Column configuration
file" is an obscure old feature which may or may not be supported
in future versions of AdeptSQL Diff. When you are starting a
data comparison between two tables, you need to determine which
columns are the Keys,
which are Compared
and which
are Ignored
(not to
mention a whole bunch of other table-level and column-level settings). When a data
comparison is run on the same tables again, it is important to be
able to re-use the configurations made earlier, instead of
re-entering them every time. Recent versions of AdeptSQL Diff
keep all DataDiff per-table configurations in a comparison project file. Earlier versions
of AdeptSQL Diff didn't have project files, so the "column
configuration file" format was invented as a
workaround.
The feature is now mostly
obsolete, but supposedly can still be useful when you know in
advance that columns with certain names all over the database are
likely to be, for example, the Key
columns. Note
that the "column configuration file" (.CCF) is a separate file, not
part of the comparison project or of the settings that Diff keeps
in the Registry. The DataDiff has an option that
refers to the .CCF-file name.
This file name can be set on the "Column Filter Config"
options page.
Once you set path to a
column configuration file, DataDiff will read the file on each data
comparison 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. Unlike the comparison
configuration stored in the project file, the only thing CCF
can determine is whether the column should be a Key,
a Compared
or an
Ignored,
but no other
details.
The CCF will
not
be applied to
tables for which a comparison configuration already
exists.
CCF
format. A Column Config File is
a text file, in a format similar to INI files. It can contain
some Section
headers, each followed by a list
of column
patterns, one column per line.
The 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 (and occasionally it might even be
useful...)
DataDiff reads the
sections sequentially, applying the rules. E.g. if a pattern in an
[Ignore] section matches to a column, the column is marked
as Ignored.
If later a more specific pattern in a [Compare] matches the same
column, it will be turned into Compared.
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. 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 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
|