Skip to content
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

fix: Avoid error by checking for existence before close. #454

Merged
merged 2 commits into from
Mar 5, 2021

Commits on Mar 4, 2021

  1. refactor: A factory for SQLAlchemyExtractors wrapped by other Extract…

    …ors.
    
    A common pattern has emerged where database-specific extractors delegate the execution
    of queries to a SQLAlchemyExtractor instance. The DB specific extractor has the code
    tailored to a DB's metadata table structure. The SQLAlchemyExtractor has the basic
    connection lifecycle code.
    
    The pattern involved a few lines of tricky-looking code to handle configs that looks
    like it has been copy-pasted from one config to the next. This pulls that out in to
    a factory function in the sql_alchemy_extractor module.
    
    Signed-off-by: Dave Cameron <dcameron@digitalocean.com>
    davcamer committed Mar 4, 2021
    Configuration menu
    Copy the full SHA
    9ce022c View commit details
    Browse the repository at this point in the history
  2. fix: Avoid error, check before calling close.

    Without checking the existence of the _alchemy_extractor attribute, and that
    the value is not None, an AttributeError can be raised when close() if called
    if the init method didn't complete. Tasks still call close to clean up, so
    this code should check if there is anything to clean up first.
    
    Signed-off-by: Dave Cameron <dcameron@digitalocean.com>
    davcamer committed Mar 4, 2021
    Configuration menu
    Copy the full SHA
    3a1539d View commit details
    Browse the repository at this point in the history