There's currently no good way to automatically filter out computed (generated, in JDBC parlance) columns from datasets.
In my case, I want to do this because I extracted some data from a database and then tried to load it into another database, and the load failed because dbUnit tried to insert the computed columns and SQL Server didn't like that very much. So I need a way to filter out the computed columns during extraction.
Merge request to follow.
Hi Rich,
Are you aware of / tried column filtering with IColumnFilter [0] / DefaultColumnFilter [1]? This is an easy way to include/exclude columns.
An example excluding two columns:
A little doc on it [2], [3]. As an example, DefaultPrepAndExpectedTestCase [4] uses this.
[0] http://dbunit.sourceforge.net/xref/org/dbunit/dataset/filter/IColumnFilter.html
[1] http://dbunit.sourceforge.net/xref/org/dbunit/dataset/filter/DefaultColumnFilter.html
[2] http://dbunit.sourceforge.net/faq.html#columnfilter
[3] http://dbunit.sourceforge.net/howto.html#compareignorecolumns
[4] http://dbunit.sourceforge.net/xref/org/dbunit/DefaultPrepAndExpectedTestCase.html#L692
Yes, I'm aware of those, but those don't really solve the problem. I don't want to have to specify a list of columns to exclude, because I just want to exclude every computed column, and the JDBC driver can tell me which columns those are. Also, having an ITable that is filtered isn't enough. I'm not using this for comparison purposes, I'm using it to write a dataset to a flat XML file. So I need the filtered ITable to be part of a IDataSet.