-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce generateStatementsFromRows for extensions #2686
Conversation
e05ee17
to
3151f7c
Compare
} | ||
} | ||
if (rows.stream().anyMatch(LoadDataRowConfig::needsPreparedStatement)) { | ||
// If we have only prepared statements and the database supports batching, let's roll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the refactoring exhibits a bit more clearly a potential bug that was already there (not sure it has practical implications at all).
"any prepared statements" gets conflated with "only prepared statements". As a result, regular statements will be skipped as soon as 1 prepared statement is created.
3151f7c
to
f838d9b
Compare
Note: all existing tests for this class pass locally and I added an extra one. |
This will allow extensions to override just the statement generation while relying on the existing CSV parsing logic. This is needed by the Neo4j extension.
f838d9b
to
9304140
Compare
…iquibase into fbiville-load-data-refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good. I moved the LoadDataRowConfig inner class definition to the bottom since that's where they tend to be in the liquibase code, and made databaseSupportsBatchUpdates()
into just supportsBatchUpdates()
Otherwise, I see how you just moved around the existing code and appreciate the extra unit test.
@nvoxland do we need to update any docs here? |
No we don't need additional docs. This change will be captured in the generated javadocs well enough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Change impacts only those who override generateStatementsFromRows from a Liquibase extension.
- New test added validating the override.
- Code refactored to be more readable (thanks, @fbiville !!).
- No further testing required.
APPROVED
This will allow extensions to override just the statement
generation while relying on the existing CSV parsing logic.
This is needed by the Neo4j extension.