larsga / Duke

Duke is a fast and flexible deduplication engine written in Java
Apache License 2.0
614 stars 194 forks source link

Dynamically changing JDBC datasource query param #234

Closed Afbcary closed 7 years ago

Afbcary commented 7 years ago

My project intends to receive IDs of entities to do record linkage on. I lookup all rows in my database which join on the ID and link them to another data set. However the query param in my DukeConfig.xml file has a static value.

Is there a method built into the Duke API which will change the query value? If not, does anyone have a suggestion on how to modify the xml file in my java code?

Thanks!

larsga commented 7 years ago

The easiest way to solve this is probably to subclass the JDBC data source. If you override the getRecords method you can set the query string when it's called, then call the getRecords implementation in the superclass, and everything will work. Just use <data-source class="class name here"> to configure it, and you should be all set.

Afbcary commented 7 years ago

Thank you for the fast response larsga! I wrote a class to modify the xml but it was ugly. This solution will be much cleaner.

larsga commented 7 years ago

Glad to hear you're satisfied. Does this mean we can close the ticket?

Afbcary commented 7 years ago

Yes.