Skip to content

Experiencing AttributeError: __exit__ since mysqlclient 1.4.0 #325

Description

@Fokko

We're experiencing error's since we've moved to 1.4.x. For example:

======================================================================
64) ERROR: test_mysql_hook_test_bulk_dump (tests.operators.test_operators.MySqlTest)
----------------------------------------------------------------------
   Traceback (most recent call last):
    tests/operators/test_operators.py line 52 in tearDown
      with MySqlHook().get_conn() as conn:
   AttributeError: __exit__

https://travis-ci.org/apache/airflow/jobs/481712513

Which uses a MySQLdb.connect(**conn_config), which returns a connection: https://github.com/PyMySQL/mysqlclient-python/blob/master/MySQLdb/connections.py

Of which the interface has been changed: c64915b#diff-1ae3b1bf2e25b3800993d7b9742c2b97

Why is this changed, and is this something that can be reverted? Personally, I'm a big fan of using a context. And otherwise, we'll have to refactor Apache Airflow.

I don't have time to investigate your issue from an incomplete code snippet.

See also: https://medium.com/@methane/why-you-must-not-ask-questions-on-github-issues-51d741d83fde

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions