Skip to content

feat(importers): add copyRecords tool for importing individual records#1817

Merged
andersju merged 1 commit into
developfrom
feature/add-tool-for-importing-records
Jul 21, 2026
Merged

feat(importers): add copyRecords tool for importing individual records#1817
andersju merged 1 commit into
developfrom
feature/add-tool-for-importing-records

Conversation

@andersju

@andersju andersju commented Jul 21, 2026

Copy link
Copy Markdown
Member

Something I've wanted for a long time but couldn't be bothered with until now.

To import sample records to a dev db we've only had the importer tool's copywhelk command, which takes a file with a list of IDs (and optionally a list of types to copy). This is mainly intended for the initial run when (re)creating a dev db. copywhelk redenormalizes the entire db and doesn't reindex on its own.

The use case this PR solves is: "I have an existing dev database and I just want to quickly import one or a few specific records and their dependencies/dependers from the prod db (and redenormalize+index only what's necessary)". Et voilà:

cd importers/
../gradlew jar

To import a couple of records by short ID, including their version history and holdings (if any):
java -Dxl.secret.properties=../secret.properties -jar build/libs/xlimporter.jar copyRecords --copy-versions --include-items ../temp_source_secret.properties 4ngh2qhg49jhnp4 vhsxx8rks82lgtn5

By IRI:
java -Dxl.secret.properties=../secret.properties -jar build/libs/xlimporter.jar copyRecords --copy-versions --include-items ../temp_source_secret.properties https://libris.kb.se/4ngh2qhg49jhnp4

Where temp_source_secret.properties contains the details for the source database (e.g. qa/stg/prod readonly...). Just like with copywhelk.

--overwrite-existing can also be specified. In that case the specified record will be updated with the contents of the source version (but then version history is not copied).

@andersju
andersju requested review from kaipoykio and kwahlin July 21, 2026 09:42

@kaipoykio kaipoykio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine!

@andersju
andersju merged commit fd8c436 into develop Jul 21, 2026
1 check passed
@andersju
andersju deleted the feature/add-tool-for-importing-records branch July 21, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants