[jira] [Commented] (AIRFLOW-4867) Cannot downgrade drop_user_and_chart migration script

2019-09-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot commented on AIRFLOW-4867:
-

stale[bot] commented on pull request #5592: [AIRFLOW-4867] check if table 
exists before creating
URL: https://github.com/apache/airflow/pull/5592
 
 
   
 

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:
us...@infra.apache.org


> Cannot downgrade drop_user_and_chart migration script
> -
>
> Key: AIRFLOW-4867
> URL: https://issues.apache.org/jira/browse/AIRFLOW-4867
> Project: Apache Airflow
>  Issue Type: Bug
>  Components: database
>Affects Versions: 1.10.3, 1.10.4
>Reporter: David Szakallas
>Priority: Major
>
> I needed to downgrade to Airflow 1.10.2 (db head rev 41f5f12752f8) from 
> Airflow 1.10.4b2 (db head rev 004c1210f153).
> When running
> {code:java}
> alembic downgrade 41f5f12752f8{code}
>  
> I faced the following error
> {code:java}
> INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
> INFO  [alembic.runtime.migration] Will assume transactional DDL.
> [2019-06-28 20:28:02,375] {migration.py:357} INFO - Running downgrade 
> 004c1210f153 -> 939bb1e647c8, increase queue name size limit
> [2019-06-28 20:28:03,719] {migration.py:357} INFO - Running downgrade 
> 939bb1e647c8 -> 4ebbffe0a39a, task reschedule fk on cascade delete
> [2019-06-28 20:28:04,241] {migration.py:357} INFO - Running downgrade 
> 4ebbffe0a39a -> dd4ecb8fbee3, cf5dc11e79ad, a56c9515abdc, Merge heads
> [2019-06-28 20:29:22,124] {migration.py:357} INFO - Running downgrade 
> dd4ecb8fbee3 -> c8ffec048a3b, Add schedule interval to dag
> [2019-06-28 20:29:22,468] {migration.py:357} INFO - Running downgrade 
> cf5dc11e79ad -> 41f5f12752f8, drop_user_and_chart
> Traceback (most recent call last):
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/sqlalchemy/engine/base.py",
>  line 1244, in _execute_context
>     cursor, statement, parameters, context
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/sqlalchemy/engine/default.py",
>  line 550, in do_execute
>     cursor.execute(statement, parameters)
> psycopg2.errors.DuplicateTable: relation "users" already exists
> The above exception was the direct cause of the following exception:
> Traceback (most recent call last):
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/bin/alembic", line 
> 11, in 
>     load_entry_point('alembic==1.0.11', 'console_scripts', 'alembic')()
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
>  line 540, in main
>     CommandLine(prog=prog).main(argv=argv)
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
>  line 534, in main
>     self.run_cmd(cfg, options)
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
>  line 514, in run_cmd
>     **dict((k, getattr(options, k, None)) for k in kwarg)
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/command.py",
>  line 317, in downgrade
>     script.run_env()
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/script/base.py",
>  line 475, in run_env
>     util.load_python_file(self.dir, "env.py")
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/util/pyfiles.py",
>  line 90, in load_python_file
>     module = load_module_py(module_id, path)
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/util/compat.py",
>  line 177, in load_module_py
>     spec.loader.exec_module(module)
>   File "", line 678, in exec_module
>   File "", line 219, in _call_with_frames_removed
>   File "migrations/env.py", line 75, in 
>     run_migrations_online()
>   File "migrations/env.py", line 69, in run_migrations_online
>     context.run_migrations()
>   File "", line 8, in run_migrations
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/runtime/environment.py",
>  line 839, in run_migrations
>     self.get_context().run_migrations(**kw)
>   File 
> "/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/runtime/migration.py",
>  line 362, in run_migrations
>     

[jira] [Commented] (AIRFLOW-4867) Cannot downgrade drop_user_and_chart migration script

2019-07-15 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on AIRFLOW-4867:
-

dszakallas commented on pull request #5592: [AIRFLOW-4867] migration script 
should check if table exists
URL: https://github.com/apache/airflow/pull/5592
 
 
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] My PR addresses the following 
[AIRFLOW-4867](https://issues.apache.org/jira/browse/AIRFLOW-4867) issues and 
references them in the PR title.
   
   ### Description
   
   - [x] Here are some details about my PR, including screenshots of any UI 
changes:
   
needed to downgrade to Airflow 1.10.2 (db head rev 41f5f12752f8) from 
Airflow 1.10.4b2 (db head rev 004c1210f153).
   
   When running
   ```
   alembic downgrade 41f5f12752f8
   ```

   
   I faced the following error
   ```
   INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
   INFO  [alembic.runtime.migration] Will assume transactional DDL.
   [2019-06-28 20:28:02,375] {migration.py:357} INFO - Running downgrade 
004c1210f153 -> 939bb1e647c8, increase queue name size limit
   [2019-06-28 20:28:03,719] {migration.py:357} INFO - Running downgrade 
939bb1e647c8 -> 4ebbffe0a39a, task reschedule fk on cascade delete
   [2019-06-28 20:28:04,241] {migration.py:357} INFO - Running downgrade 
4ebbffe0a39a -> dd4ecb8fbee3, cf5dc11e79ad, a56c9515abdc, Merge heads
   [2019-06-28 20:29:22,124] {migration.py:357} INFO - Running downgrade 
dd4ecb8fbee3 -> c8ffec048a3b, Add schedule interval to dag
   [2019-06-28 20:29:22,468] {migration.py:357} INFO - Running downgrade 
cf5dc11e79ad -> 41f5f12752f8, drop_user_and_chart
   Traceback (most recent call last):
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/sqlalchemy/engine/base.py",
 line 1244, in _execute_context
   cursor, statement, parameters, context
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/sqlalchemy/engine/default.py",
 line 550, in do_execute
   cursor.execute(statement, parameters)
   psycopg2.errors.DuplicateTable: relation "users" already exists
   
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/bin/alembic", line 
11, in 
   load_entry_point('alembic==1.0.11', 'console_scripts', 'alembic')()
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
 line 540, in main
   CommandLine(prog=prog).main(argv=argv)
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
 line 534, in main
   self.run_cmd(cfg, options)
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/config.py",
 line 514, in run_cmd
   **dict((k, getattr(options, k, None)) for k in kwarg)
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/command.py",
 line 317, in downgrade
   script.run_env()
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/script/base.py",
 line 475, in run_env
   util.load_python_file(self.dir, "env.py")
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/util/pyfiles.py",
 line 90, in load_python_file
   module = load_module_py(module_id, path)
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/util/compat.py",
 line 177, in load_module_py
   spec.loader.exec_module(module)
 File "", line 678, in exec_module
 File "", line 219, in 
_call_with_frames_removed
 File "migrations/env.py", line 75, in 
   run_migrations_online()
 File "migrations/env.py", line 69, in run_migrations_online
   context.run_migrations()
 File "", line 8, in run_migrations
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/runtime/environment.py",
 line 839, in run_migrations
   self.get_context().run_migrations(**kw)
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/runtime/migration.py",
 line 362, in run_migrations
   step.migration_fn(**kw)
 File 
"/Users/dszakallas/Projects/airflow/airflow/migrations/versions/cf5dc11e79ad_drop_user_and_chart.py",
 line 66, in downgrade
   sa.UniqueConstraint('username')
 File "", line 8, in create_table
 File "", line 3, in create_table
 File 
"/Users/dszakallas/.pyenv/versions/3.6.6/envs/pds-airflow/lib/python3.6/site-packages/alembic/operations/ops.py",
 line 1248, in create_table