0

I am using schemacrawler cli to generate diagrams for my database.

I do not have many FK relationships in my db and so I am relying on weak-associations. But the these weak associations are not accurate. Is there any way to plugin custom logic for this detection?

The only associations that I want to plot are:

  1. When tablename_id column in any table in a database maps to tablename.id in the same database. There are thousands of these associations.
  2. Plus the 10 or 20 custom defined associations in the yml file.

I know I can manually define the associations in the yaml file but that is not a feasible option. I also know that I can build a custom script to generate the said yaml file, but that might not be as performant as being able to plugin the logic into the flow.

1 Answers1

0

You should be able to plug in a custom catalog loader. Catalog loaders are loaded by the Java Service Provider Interface (SPI), and the WeakAssociationsCatalogLoader itself is loaded dynamically from the CLASSPATH. You can write your own implementation in your own jar file, and add it to the CLASSPATH, or simply drop your jar into SchemaCrawler's lib folder if you are using the command-line. Your jar file should have the SPI properties file, like this one - schemacrawler.tools.catalogloader.CatalogLoader.

It seems like your idea may be useful to other people. If you make your implementation an open-source project, please let me know, and I will link to it from the SchemaCrawler website.

Sualeh Fatehi SchemaCrawler

Sualeh Fatehi
  • 4,700
  • 2
  • 24
  • 28