firefumavn opened a new issue #16825:
URL: https://github.com/apache/airflow/issues/16825
Apache Airflow version: 2.1.0
I execute airflow db init command I get errors like below:
`
DB:
mssql+pyodbc://sqlserver:***@10.93.128.223/Airflow?ApplicationIntent=ReadOnly&TrustedConnection=Yes&driver=ODBC+Driver+17+for+SQL+Server
[2021-07-06 10:48:05,820] {db.py:695} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl MSSQLImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade cf5dc11e79ad ->
bbf4a7ad0465, Remove id column from xcom
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1277, in _execute_context
cursor, statement, parameters, context
File
"/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line
608, in do_execute
cursor.execute(statement, parameters)
pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for
SQL Server][SQL Server]The object 'PK__xcom__3213E83F9767B45F' is dependent on
column 'id'. (5074) (SQLExecDirectW)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/airflow", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/airflow/__main__.py", line
40, in main
args.func(args)
File "/usr/local/lib/python3.6/dist-packages/airflow/cli/cli_parser.py",
line 48, in command
return func(*args, **kwargs)
File
"/usr/local/lib/python3.6/dist-packages/airflow/cli/commands/db_command.py",
line 31, in initdb
db.initdb()
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line
566, in initdb
upgradedb()
File "/usr/local/lib/python3.6/dist-packages/airflow/utils/db.py", line
705, in upgradedb
command.upgrade(config, 'heads')
File "/usr/local/lib/python3.6/dist-packages/alembic/command.py", line
294, in upgrade
script.run_env()
File "/usr/local/lib/python3.6/dist-packages/alembic/script/base.py", line
490, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.6/dist-packages/alembic/util/pyfiles.py",
line 97, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python3.6/dist-packages/alembic/util/compat.py", line
184, in load_module_py
spec.loader.exec_module(module)
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/dist-packages/airflow/migrations/env.py",
line 116, in <module>
run_migrations_online()
File "/usr/local/lib/python3.6/dist-packages/airflow/migrations/env.py",
line 107, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File
"/usr/local/lib/python3.6/dist-packages/alembic/runtime/environment.py", line
813, in run_migrations
self.get_context().run_migrations(**kw)
File
"/usr/local/lib/python3.6/dist-packages/alembic/runtime/migration.py", line
561, in run_migrations
step.migration_fn(**kw)
File
"/usr/local/lib/python3.6/dist-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 "/usr/lib/python3.6/contextlib.py", line 88, in __exit__
next(self.gen)
File "/usr/local/lib/python3.6/dist-packages/alembic/operations/base.py",
line 336, in batch_alter_table
impl.flush()
File "/usr/local/lib/python3.6/dist-packages/alembic/operations/batch.py",
line 86, in flush
fn(*arg, **kw)
File "/usr/local/lib/python3.6/dist-packages/alembic/ddl/mssql.py", line
184, in drop_column
table_name, column, schema=schema, **kw
File "/usr/local/lib/python3.6/dist-packages/alembic/ddl/impl.py", line
259, in drop_column
self._exec(base.DropColumn(table_name, column, schema=schema))
File "/usr/local/lib/python3.6/dist-packages/alembic/ddl/mssql.py", line
50, in _exec
result = super(MSSQLImpl, self)._exec(construct, *args, **kw)
File "/usr/local/lib/python3.6/dist-packages/alembic/ddl/impl.py", line
146, in _exec
return conn.execute(construct, multiparams)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1011, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/ddl.py", line
72, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1073, in _execute_ddl
compiled,
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1317, in _execute_context
e, statement, parameters, cursor, context
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1511, in _handle_dbapi_exception
sqlalchemy_exception, with_traceback=exc_info[2], from_=e
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py",
line 182, in raise_
raise exception
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py",
line 1277, in _execute_context
cursor, statement, parameters, context
File
"/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line
608, 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__3213E83F9767B45F' 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)
`
Then I check the database, many tables are missing columns.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]