Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Setup callback hook for base classes #246

Closed
MeltyBot opened this issue Oct 20, 2021 · 2 comments
Closed

Setup callback hook for base classes #246

MeltyBot opened this issue Oct 20, 2021 · 2 comments

Comments

@MeltyBot
Copy link
Contributor

Migrated from GitLab: https://gitlab.com/meltano/sdk/-/issues/247

Originally created by @rabidaudio on 2021-10-20 16:06:02


Streams and Sinks often need to do some setup before the EL process. For example, a Sink may need to update table schemas in the target database, a Stream may need to open a connection, etc.

Users can put this stuff in constructors but I see a few problems with this:

  • the constructors have some complex arguments, and we probably want to discourage users from overriding the base constructor so that we can change the arguments in the future
  • it makes testing a bit complicated, as you can't have an instance of the class without it doing setup

My proposal is a simple method (prepare? setup? something to that effect) with a default pass implementation that is called before any messages come in/out. Perhaps also a corresponding teardown method for resources that need to be cleaned up like database connections.

@MeltyBot
Copy link
Contributor Author

Copy link

stale bot commented Jul 4, 2024

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

@stale stale bot added the stale label Jul 4, 2024
@stale stale bot closed this as completed Jul 25, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants