Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-5511

MSSQL resetdb /initdb for 1.10.5 fails to set ti_pool non nullable

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.10.5
    • Fix Version/s: None
    • Component/s: celery, database
    • Labels:
      None

      Description

      Airflow 1.10.5 installation with MSSQL backend and celery fails with below error .

       

      Traceback (most recent call last):

        File "/bin/airflow", line 32, in <module>

          args.func(args)

        File "/usr/lib/python2.7/site-packages/airflow/bin/cli.py", line 1112, in resetdb

          db.resetdb(settings.RBAC)

        File "/usr/lib/python2.7/site-packages/airflow/utils/db.py", line 406, in resetdb

          initdb(rbac)

        File "/usr/lib/python2.7/site-packages/airflow/utils/db.py", line 106, in initdb

          upgradedb()

        File "/usr/lib/python2.7/site-packages/airflow/utils/db.py", line 377, in upgradedb

          command.upgrade(config, 'heads')

        File "/usr/lib/python2.7/site-packages/alembic/command.py", line 279, in upgrade

          script.run_env()

        File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 475, in run_env

          util.load_python_file(self.dir, "env.py")

        File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file

          module = load_module_py(module_id, path)

        File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 240, in load_module_py

          mod = imp.load_source(module_id, path, fp)

        File "/usr/lib/python2.7/site-packages/airflow/migrations/env.py", line 92, in <module>

          run_migrations_online()

        File "/usr/lib/python2.7/site-packages/airflow/migrations/env.py", line 86, in run_migrations_online

          context.run_migrations()

        File "<string>", line 8, in run_migrations

        File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 846, in run_migrations

          self.get_context().run_migrations(**kw)

        File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 365, in run_migrations

          step.migration_fn(**kw)

        File "/usr/lib/python2.7/site-packages/airflow/migrations/versions/6e96a59344a4_make_taskinstance_pool_not_nullable.py", line 101, in upgrade

          nullable=False,

        File "/usr/lib64/python2.7/contextlib.py", line 24, in _exit_

          self.gen.next()

        File "/usr/lib/python2.7/site-packages/alembic/operations/base.py", line 325, in batch_alter_table

          impl.flush()

        File "/usr/lib/python2.7/site-packages/alembic/operations/batch.py", line 79, in flush

          fn(*arg, **kw)

        File "/usr/lib/python2.7/site-packages/alembic/ddl/mssql.py", line 85, in alter_column

          **kw

        File "/usr/lib/python2.7/site-packages/alembic/ddl/impl.py", line 172, in alter_column

          existing_comment=existing_comment,

        File "/usr/lib/python2.7/site-packages/alembic/ddl/mssql.py", line 36, in _exec

          result = super(MSSQLImpl, self)._exec(construct, *args, **kw)

        File "/usr/lib/python2.7/site-packages/alembic/ddl/impl.py", line 134, in _exec

          return conn.execute(construct, *multiparams, **params)

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute

          return meth(self, multiparams, params)

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection

          return connection._execute_ddl(self, multiparams, params)

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1050, in _execute_ddl

          compiled,

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context

          e, statement, parameters, cursor, context

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception

          util.raise_from_cause(sqlalchemy_exception, exc_info)

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 398, 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 1249, in _execute_context

          cursor, statement, parameters, context

        File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute

          cursor.execute(statement, parameters)

      sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The index 'ti_pool' is dependent on column 'pool'. (5074) (SQLExecDirectW)")

      [SQL: ALTER TABLE task_instance ALTER COLUMN pool VARCHAR(50) NOT NULL]

      (Background on this error at: http://sqlalche.me/e/f405)

       

       

        Attachments

        1. airflowbug
          4 kB
          ROHIT K RAMWAL

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                rramwal ROHIT K RAMWAL
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: