0

I am trying to create the migration:

python manage.py db migrate

Getting the following stack trace: I tracked it down to the

[2019-08-12 17:09:11,197] INFO in __init__: Project API
INFO  [alembic.runtime.migration] Context impl OracleImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.autogenerate.compare] Detected removed table 'program'
INFO  [alembic.autogenerate.compare] Detected removed index 'alerts_idx' on 'alerts'
INFO  [alembic.autogenerate.compare] Detected removed table 'alerts'
INFO  [alembic.autogenerate.compare] Detected removed index 'error_log_err_date_idx' on 'error_log'
Traceback (most recent call last):
  File ".vscode\extensions\ms-python.python-2019.8.29288\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File ".vscode\extensions\ms-python.python-2019.8.29288\pythonFiles\lib\python\ptvsd\__main__.py", line 432, in main
    run()
  File "Desktop\Project\MVP\myVE\lib\site-packages\alembic\autogenerate\compare.py", line 612, in obj_removed
    modify_ops.ops.append(ops.DropIndexOp.from_index(obj.const))
  File "Desktop\Project\MVP\myVE\lib\site-packages\alembic\operations\ops.py", line 1026, in from_index
    index.table.name,
AttributeError: 'NoneType' object has no attribute 'name'

Trimed for bravity

Lev
  • 999
  • 2
  • 10
  • 26

1 Answers1

0

I had to put a print statement right before line:

print(index)

File "Desktop\Project\MVP\myVE\lib\site-packages\alembic\operations\ops.py", line 1026, in from_index

When I looked at the index on the table it created a "virtual"/"calculated" column trun(some_date_column) so it makes sense that it would not have a table associated.

Removed the index and alembic started working.

Wanted to share with anyone who might hit this in the future.

Lev
  • 999
  • 2
  • 10
  • 26