source-mysql-batch: Paying down some technical debt #2400
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR takes the
source-mysql-batch
test suite from "hilariously poorly tested" to "probably a bit over-tested" with about 700 lines of new test code covering all the important MySQL column types as well as various edge cases of key/cursor handling.This PR also adds
table
andschema
properties to the resource config struct and implements the same logic thatsource-postgres-batch
has had for some time where if a query template is specified in the resource config we use it, but otherwise the connector knows what default query to use and plugs in the table/schema name from the resource into that hard-coded default, and when discovering new tables we always leave the template override blank.I intend to do both of these things for the other batch SQL capture connectors in the near future, because I would really like to be able to make changes to them all with more confidence.
Workflow steps:
Nothing should change for existing users. New users will no longer have a big ugly template to look at if they inspect the discovered resource bindings, but they still have the option of writing their own if they really want to.
Notes:
If you look closely at the datatype test snapshots you might notice that our serialization of some column types is...less than optimal. We might want to consider improving that soon, but right now my goal was just to document via snapshots the current connector behavior so we can at least tell if a future change impacts anything.
This change is