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/12/28 17:14:26 UTC

[GitHub] [airflow] rajashekar opened a new issue #13344: airflow db init failing on Azure mssql

rajashekar opened a new issue #13344:
URL: https://github.com/apache/airflow/issues/13344


   **Apache Airflow version**:2.0.0
   
   **Environment**: 
   macOS Catalina - 10.15.7
   Python 3.8.5
   Azure mssql 
   - **OS** (e.g. from /etc/os-release): macOS Catalina 
   
   
   **What happened**:
   `airflow db init` is failing at `Remove id column from xcom`
   
   Below is the complete log - 
   ```
   DB: mssql+pyodbc://user:***@127.0.0.1:1433/dev?TrustedConnection=Yes&driver=ODBC+Driver+17+for+SQL+Server
   [2020-12-28 08:50:37,779] {db.py:678} INFO - Creating tables
   INFO  [alembic.runtime.migration] Context impl MSSQLImpl.
   INFO  [alembic.runtime.migration] Will assume transactional DDL.
   INFO  [alembic.runtime.migration] Running upgrade  -> e3a246e0dc1, current schema
   INFO  [alembic.runtime.migration] Running upgrade e3a246e0dc1 -> 1507a7289a2f, create is_encrypted
   INFO  [alembic.runtime.migration] Running upgrade 1507a7289a2f -> 13eb55f81627, maintain history for compatibility with earlier migrations
   INFO  [alembic.runtime.migration] Running upgrade 13eb55f81627 -> 338e90f54d61, More logging into task_instance
   INFO  [alembic.runtime.migration] Running upgrade 338e90f54d61 -> 52d714495f0, job_id indices
   INFO  [alembic.runtime.migration] Running upgrade 52d714495f0 -> 502898887f84, Adding extra to Log
   INFO  [alembic.runtime.migration] Running upgrade 502898887f84 -> 1b38cef5b76e, add dagrun
   INFO  [alembic.runtime.migration] Running upgrade 1b38cef5b76e -> 2e541a1dcfed, task_duration
   INFO  [alembic.runtime.migration] Running upgrade 2e541a1dcfed -> 40e67319e3a9, dagrun_config
   INFO  [alembic.runtime.migration] Running upgrade 40e67319e3a9 -> 561833c1c74b, add password column to user
   INFO  [alembic.runtime.migration] Running upgrade 561833c1c74b -> 4446e08588, dagrun start end
   INFO  [alembic.runtime.migration] Running upgrade 4446e08588 -> bbc73705a13e, Add notification_sent column to sla_miss
   INFO  [alembic.runtime.migration] Running upgrade bbc73705a13e -> bba5a7cfc896, Add a column to track the encryption state of the 'Extra' field in connection
   INFO  [alembic.runtime.migration] Running upgrade bba5a7cfc896 -> 1968acfc09e3, add is_encrypted column to variable table
   INFO  [alembic.runtime.migration] Running upgrade 1968acfc09e3 -> 2e82aab8ef20, rename user table
   INFO  [alembic.runtime.migration] Running upgrade 2e82aab8ef20 -> 211e584da130, add TI state index
   INFO  [alembic.runtime.migration] Running upgrade 211e584da130 -> 64de9cddf6c9, add task fails journal table
   INFO  [alembic.runtime.migration] Running upgrade 64de9cddf6c9 -> f2ca10b85618, add dag_stats table
   INFO  [alembic.runtime.migration] Running upgrade f2ca10b85618 -> 4addfa1236f1, Add fractional seconds to mysql tables
   INFO  [alembic.runtime.migration] Running upgrade 4addfa1236f1 -> 8504051e801b, xcom dag task indices
   INFO  [alembic.runtime.migration] Running upgrade 8504051e801b -> 5e7d17757c7a, add pid field to TaskInstance
   INFO  [alembic.runtime.migration] Running upgrade 5e7d17757c7a -> 127d2bf2dfa7, Add dag_id/state index on dag_run table
   INFO  [alembic.runtime.migration] Running upgrade 127d2bf2dfa7 -> cc1e65623dc7, add max tries column to task instance
   WARNI [unusual_prefix_c97b36ce8ab592603f65d5a8cdd67704f8ac47e3_example_kubernetes_executor_config] Could not import DAGs in example_kubernetes_executor_config.py: No module named 'kubernetes'
   WARNI [unusual_prefix_c97b36ce8ab592603f65d5a8cdd67704f8ac47e3_example_kubernetes_executor_config] Install kubernetes dependencies with: pip install apache-airflow['cncf.kubernetes']
   INFO  [alembic.runtime.migration] Running upgrade cc1e65623dc7 -> bdaa763e6c56, Make xcom value column a large binary
   INFO  [alembic.runtime.migration] Running upgrade bdaa763e6c56 -> 947454bf1dff, add ti job_id index
   INFO  [alembic.runtime.migration] Running upgrade 947454bf1dff -> d2ae31099d61, Increase text size for MySQL (not relevant for other DBs' text types)
   INFO  [alembic.runtime.migration] Running upgrade d2ae31099d61 -> 0e2a74e0fc9f, Add time zone awareness
   INFO  [alembic.runtime.migration] Running upgrade d2ae31099d61 -> 33ae817a1ff4, kubernetes_resource_checkpointing
   INFO  [alembic.runtime.migration] Running upgrade 33ae817a1ff4 -> 27c6a30d7c24, kubernetes_resource_checkpointing
   INFO  [alembic.runtime.migration] Running upgrade 27c6a30d7c24 -> 86770d1215c0, add kubernetes scheduler uniqueness
   INFO  [alembic.runtime.migration] Running upgrade 86770d1215c0, 0e2a74e0fc9f -> 05f30312d566, merge heads
   INFO  [alembic.runtime.migration] Running upgrade 05f30312d566 -> f23433877c24, fix mysql not null constraint
   INFO  [alembic.runtime.migration] Running upgrade f23433877c24 -> 856955da8476, fix sqlite foreign key
   INFO  [alembic.runtime.migration] Running upgrade 856955da8476 -> 9635ae0956e7, index-faskfail
   INFO  [alembic.runtime.migration] Running upgrade 9635ae0956e7 -> dd25f486b8ea, add idx_log_dag
   INFO  [alembic.runtime.migration] Running upgrade dd25f486b8ea -> bf00311e1990, add index to taskinstance
   INFO  [alembic.runtime.migration] Running upgrade 9635ae0956e7 -> 0a2a5b66e19d, add task_reschedule table
   INFO  [alembic.runtime.migration] Running upgrade 0a2a5b66e19d, bf00311e1990 -> 03bc53e68815, merge_heads_2
   INFO  [alembic.runtime.migration] Running upgrade 03bc53e68815 -> 41f5f12752f8, add superuser field
   INFO  [alembic.runtime.migration] Running upgrade 41f5f12752f8 -> c8ffec048a3b, add fields to dag
   INFO  [alembic.runtime.migration] Running upgrade c8ffec048a3b -> dd4ecb8fbee3, Add schedule interval to dag
   INFO  [alembic.runtime.migration] Running upgrade dd4ecb8fbee3 -> 939bb1e647c8, task reschedule fk on cascade delete
   INFO  [alembic.runtime.migration] Running upgrade 939bb1e647c8 -> 6e96a59344a4, Make TaskInstance.pool not nullable
   INFO  [alembic.runtime.migration] Running upgrade 6e96a59344a4 -> d38e04c12aa2, add serialized_dag table
   INFO  [alembic.runtime.migration] Running upgrade d38e04c12aa2 -> b3b105409875, add root_dag_id to DAG
   INFO  [alembic.runtime.migration] Running upgrade 6e96a59344a4 -> 74effc47d867, change datetime to datetime2(6) on MSSQL tables
   INFO  [alembic.runtime.migration] Running upgrade 939bb1e647c8 -> 004c1210f153, increase queue name size limit
   INFO  [alembic.runtime.migration] Running upgrade c8ffec048a3b -> a56c9515abdc, Remove dag_stat table
   INFO  [alembic.runtime.migration] Running upgrade a56c9515abdc, 004c1210f153, 74effc47d867, b3b105409875 -> 08364691d074, Merge the four heads back together
   INFO  [alembic.runtime.migration] Running upgrade 08364691d074 -> fe461863935f, increase_length_for_connection_password
   INFO  [alembic.runtime.migration] Running upgrade fe461863935f -> 7939bcff74ba, Add DagTags table
   INFO  [alembic.runtime.migration] Running upgrade 7939bcff74ba -> a4c2fd67d16b, add pool_slots field to task_instance
   INFO  [alembic.runtime.migration] Running upgrade a4c2fd67d16b -> 852ae6c715af, Add RenderedTaskInstanceFields table
   INFO  [alembic.runtime.migration] Running upgrade 852ae6c715af -> 952da73b5eff, add dag_code table
   INFO  [alembic.runtime.migration] Running upgrade 952da73b5eff -> a66efa278eea, Add Precision to execution_date in RenderedTaskInstanceFields table
   INFO  [alembic.runtime.migration] Running upgrade a66efa278eea -> da3f683c3a5a, Add dag_hash Column to serialized_dag table
   INFO  [alembic.runtime.migration] Running upgrade da3f683c3a5a -> 92c57b58940d, Create FAB Tables
   INFO  [alembic.runtime.migration] Running upgrade 92c57b58940d -> 03afc6b6f902, Increase length of FAB ab_view_menu.name column
   INFO  [alembic.runtime.migration] Running upgrade 03afc6b6f902 -> cf5dc11e79ad, drop_user_and_chart
   INFO  [alembic.runtime.migration] Running upgrade cf5dc11e79ad -> bbf4a7ad0465, Remove id column from xcom
   Traceback (most recent call last):
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
       self.dialect.do_execute(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute
       cursor.execute(statement, parameters)
   pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'PK__xcom__3213E83F9E21F3FE' is dependent on column 'id'. (5074) (SQLExecDirectW)")
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/__main__.py", line 40, in main
       args.func(args)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 48, in command
       return func(*args, **kwargs)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/cli/commands/db_command.py", line 31, in initdb
       db.initdb()
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/utils/db.py", line 549, in initdb
       upgradedb()
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/utils/db.py", line 688, in upgradedb
       command.upgrade(config, 'heads')
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/command.py", line 298, in upgrade
       script.run_env()
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/script/base.py", line 489, in run_env
       util.load_python_file(self.dir, "env.py")
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
       module = load_module_py(module_id, path)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/util/compat.py", line 184, in load_module_py
       spec.loader.exec_module(module)
     File "<frozen importlib._bootstrap_external>", line 783, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/migrations/env.py", line 108, in <module>
       run_migrations_online()
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/migrations/env.py", line 102, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/runtime/environment.py", line 846, in run_migrations
       self.get_context().run_migrations(**kw)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/runtime/migration.py", line 522, in run_migrations
       step.migration_fn(**kw)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/airflow/migrations/versions/bbf4a7ad0465_remove_id_column_from_xcom.py", line 48, in upgrade
       bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 'execution_date'])
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/contextlib.py", line 120, in __exit__
       next(self.gen)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/operations/base.py", line 353, in batch_alter_table
       impl.flush()
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/operations/batch.py", line 82, in flush
       fn(*arg, **kw)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/ddl/mssql.py", line 155, in drop_column
       super(MSSQLImpl, self).drop_column(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/ddl/impl.py", line 241, in drop_column
       self._exec(base.DropColumn(table_name, column, schema=schema))
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/ddl/mssql.py", line 38, in _exec
       result = super(MSSQLImpl, self)._exec(construct, *args, **kw)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/alembic/ddl/impl.py", line 141, in _exec
       return conn.execute(construct, *multiparams, **params)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
       return meth(self, multiparams, params)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
       return connection._execute_ddl(self, multiparams, params)
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1068, in _execute_ddl
       ret = self._execute_context(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
       self._handle_dbapi_exception(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
       util.raise_(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
       raise exception
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
       self.dialect.do_execute(
     File "/Users/rchint1/opt/anaconda3/envs/atg2legato/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The object 'PK__xcom__3213E83F9E21F3FE' is dependent on column 'id'. (5074) (SQLExecDirectW)")
   [SQL: ALTER TABLE xcom DROP COLUMN id]
   (Background on this error at: http://sqlalche.me/e/13/f405)
   ```
   
   **What you expected to happen**:
   `airflow db init` successfully done. 
   
   <!-- What do you think went wrong? -->
   Might be `Remove id column from xcom` - First constraints needs to be dropped for mssql. 
   Note: With same setup tried with Postgres everything went fine but when using Azure mssql seeing this issue. 
   
   **How to reproduce it**:
   1) Create Azure sql db
   2) Use latest airflow and do `airflow db init`. 


----------------------------------------------------------------
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



[GitHub] [airflow] potiuk closed issue #13344: airflow db init failing on Azure mssql

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #13344:
URL: https://github.com/apache/airflow/issues/13344


   


----------------------------------------------------------------
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



[GitHub] [airflow] potiuk commented on issue #13344: airflow db init failing on Azure mssql

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #13344:
URL: https://github.com/apache/airflow/issues/13344#issuecomment-751819085


   Sorry but mssql is not officially supported by Airflow. See http://airflow.apache.org/docs/apache-airflow/stable/howto/initialize-database.html . More detailed requiremens are here: https://github.com/potiuk/airflow#requirements
   
   There is an ongoing discussion about improving compatibility with MSQL #9973  but this requires quite an investment in building reproducible CI pipelines and proably rewriting some of the code related to locks and HA scheduler in 2.0. This is not currently planned. You should switch to Postgres or MySQL.


----------------------------------------------------------------
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



[GitHub] [airflow] boring-cyborg[bot] commented on issue #13344: airflow db init failing on Azure mssql

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #13344:
URL: https://github.com/apache/airflow/issues/13344#issuecomment-751792749


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


----------------------------------------------------------------
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