You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jayce Li (JIRA)" <ji...@apache.org> on 2018/11/19 13:00:02 UTC

[jira] [Commented] (AIRFLOW-3036) Upgrading to Airflow 1.10 not possible using GCP Cloud SQL for MYSQL

    [ https://issues.apache.org/jira/browse/AIRFLOW-3036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691670#comment-16691670 ] 

Jayce Li commented on AIRFLOW-3036:
-----------------------------------

My team already deployed airflow 1.9.1 on gcp k8s with mysql 5.7 in cloudsql.

When I changed the cloudsql unsupport flag like +explicit_defaults_for_timestamp+ by cur = conn.execute("SET {{explicit_defaults_for_timestamp=1}}")`, got the following error:
{code:java}
cur = conn.execute("SET explicit_defaults_for_timestamp=1")`
statement, parameters
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
    context)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
    exc_info
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
    context)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1227, 'Access denied; you need (at least one of) the SUPER privilege(s) for this operation') [SQL: 'SET explicit_defaults_for_timestamp=1'] (Background on this error at: http://sqlalche.me/e/e3q8)
{code}
 

That seem like it require the SUPER privilege, but Cloud SQL does not support {{SUPER}} privileges.

Any workarounds way?

 

ref: [https://stackoverflow.com/questions/28805775/google-cloud-sql-instance-super-privilege-error]
ref: [https://cloud.google.com/sql/faq]

 

> Upgrading to Airflow 1.10 not possible using GCP Cloud SQL for MYSQL
> --------------------------------------------------------------------
>
>                 Key: AIRFLOW-3036
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3036
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: core, db
>    Affects Versions: 1.10.0
>         Environment: Google Cloud Platform, Google Kubernetes Engine, Airflow 1.10 on Debian Stretch, Google Cloud SQL MySQL
>            Reporter: Smith Mathieu
>            Priority: Blocker
>              Labels: 1.10, google, google-cloud-sql
>
> The upgrade path to airflow 1.10 seems impossible for users of MySQL in Google's Cloud SQL service given new mysql requirements for 1.10.
>  
> When executing "airflow upgradedb"
> ```
>  INFO [alembic.runtime.migration] Running upgrade d2ae31099d61 -> 0e2a74e0fc9f, Add time zone awareness
>  Traceback (most recent call last):
>  File "/usr/local/bin/airflow", line 32, in <module>
>  args.func(args)
>  File "/usr/local/lib/python3.6/site-packages/airflow/bin/cli.py", line 1002, in initdb
>  db_utils.initdb(settings.RBAC)
>  File "/usr/local/lib/python3.6/site-packages/airflow/utils/db.py", line 92, in initdb
>  upgradedb()
>  File "/usr/local/lib/python3.6/site-packages/airflow/utils/db.py", line 346, in upgradedb
>  command.upgrade(config, 'heads')
>  File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line 174, in upgrade
>  script.run_env()
>  File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", line 416, in run_env
>  util.load_python_file(self.dir, 'env.py')
>  File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
>  module = load_module_py(module_id, path)
>  File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", line 68, in load_module_py
>  module_id, path).load_module(module_id)
>  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
>  File "<frozen importlib._bootstrap_external>", line 823, in load_module
>  File "<frozen importlib._bootstrap_external>", line 682, in load_module
>  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
>  File "<frozen importlib._bootstrap>", line 684, in _load
>  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
>  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
>  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
>  File "/usr/local/lib/python3.6/site-packages/airflow/migrations/env.py", line 91, in <module>
>  run_migrations_online()
>  File "/usr/local/lib/python3.6/site-packages/airflow/migrations/env.py", line 86, in run_migrations_online
>  context.run_migrations()
>  File "<string>", line 8, in run_migrations
>  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", line 807, in run_migrations
>  self.get_context().run_migrations(**kw)
>  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
>  step.migration_fn(**kw)
>  File "/usr/local/lib/python3.6/site-packages/airflow/migrations/versions/0e2a74e0fc9f_add_time_zone_awareness.py", line 46, in upgrade
>  raise Exception("Global variable explicit_defaults_for_timestamp needs to be on (1) for mysql")
>  Exception: Global variable explicit_defaults_for_timestamp needs to be on (1) for mysql
>  ```
>   
> Reading documentation for upgrading to airflow 1.10, it seems the requirement for explicit_defaults_for_timestamp=1 was intentional. 
>  
> However,  MySQL on Google Cloud SQL does not support configuring this variable and it is off by default. Users of MySQL and Cloud SQL do not have an upgrade path to 1.10. Alas, so close to the mythical Kubernetes Executor.
> In GCP, Cloud SQL is _the_ hosted MySQL solution. 
> [https://cloud.google.com/sql/docs/mysql/flags]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)