GitHub
08/07/2024, 8:21 PMscheam = None in the stream class). The only way to modify the number of records used to infer the schema is to pass it in as a parameter to the creation of the RESTStream class (see example in unit tests).
There is a placeholder method in the core Stream class for schema inference but the major complication to actually running it there is this: The infer_schema method needs access to a method like request_records which is only implemented in the RESTStream class. I have not implemented this in the GraphQLStream because a request_records method isn't provided there, though we could get the same effect with some extra lines of code.
An additional intricacy that needed to be resolved was the timing of the instantiation of RESTStream parent class Stream. It needed to come after the instantiation of the self._http_headers attribute which is required for the request_records method to work.
This is just a proof of concept and I'm submitting it now in order to get feedback. @aaronsteers , this is a departure from our conversation about this during the call. I decided it would be easier to implement this as part of the SDK directly rather than through a CLI command first so that we could figure out all the dependencies required to run the schema inference appropriately. Later we can implement a CLI command.
Unit tests are provided and are the only way I've tested it so far. So if there are more robust methods for testing I would recommend we pursue them.
meltano/sdkGitHub
08/07/2024, 8:21 PM