You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/02 14:19:19 UTC
[GitHub] [airflow] mik-laj commented on a change in pull request #8066: Add
1.10 import fallback in GCS to Presto system test
mik-laj commented on a change in pull request #8066: Add 1.10 import fallback in GCS to Presto system test
URL: https://github.com/apache/airflow/pull/8066#discussion_r402349897
##########
File path: tests/providers/google/cloud/operators/test_presto_to_gcs_system.py
##########
@@ -22,10 +22,20 @@
from airflow.models import Connection
from airflow.providers.presto.hooks.presto import PrestoHook
-from airflow.utils.session import create_session
from tests.providers.google.cloud.utils.gcp_authenticator import GCP_BIGQUERY_KEY, GCP_GCS_KEY
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context
+try:
+ from airflow.utils.session import create_session
+except ImportError:
+ # This is a hack to import create_session from old destination and
+ # fool the pre-commit check that looks for old imports...
+ # TODO remove this once we don't need to test this on 1.10
+ import importlib
+ db_module = importlib.import_module("airflow.utils.db")
+ create_session = getattr(db_module, "create_session")
Review comment:
```suggestion
create_session = import_string("airflow.utils.db.create_session")
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services