I'm using the SchemaCrawler API in a data migration tool I'm developing. This is running on MySQL 5.6.25 with v16.16.9 of the SchemaCrawler API. Unfortunately, SC isn't finding any weak relationships in the database, even though other tools are identifying them. In the sample below, I'm looping through every table in the database and printing the weak associations, but the weak associations collection is always empty:
for (Map.Entry<String, Table> entry : tableMap.entrySet()) {
String tableName = entry.getKey();
Table sampleTable = entry.getValue();
Collection<WeakAssociation> weakAssociations = sampleTable.getWeakAssociations();
System.out.println(String.format("Table: %s, associations=%s", tableName, weakAssociations));
}
I couldn't find any sample code relating to weak associations, so maybe I'm just using it incorrectly. Any help is appeciated.
You need to set "weak-associations" to true in the configuration. Please take a look at WeakAssociationsTest for example code.
Sualeh Fatehi, SchemaCrawler