Last modified: 2014-10-15 17:54:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66294, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64294 - Alembic upgrade head should not try to access testing DB when running in production
Alembic upgrade head should not try to access testing DB when running in prod...
Status: RESOLVED FIXED
Product: Analytics
Classification: Unclassified
Wikimetrics (Other open bugs)
unspecified
All All
: Normal normal
: ---
Assigned To: Marcel Ruiz Forns
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-23 15:15 UTC by nuria
Modified: 2014-10-15 17:54 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description nuria 2014-04-23 15:15:15 UTC
Alembic upgrade head should not try to access (wikimetrics_testing) testing DB when running in production. 


When debug = false alembic should just be concerned with wikimetric databases.

Please see also bug 64001, which is also alembic related.
Comment 1 Marcel Ruiz Forns 2014-10-14 20:10:06 UTC
This is already working.

See stdout when executing 'alembic upgrade HEAD' in these 2 cases:

1) When 'DEBUG = True' in ./wikimetrics/config/db_config.yaml, output is:

INFO  [alembic.migration] Context impl MySQLImpl.
INFO  [alembic.migration] Will assume non-transactional DDL.
Running migration for wikimetrics
INFO  [alembic.migration] Context impl MySQLImpl.
INFO  [alembic.migration] Will assume non-transactional DDL.
Running migration for wikimetrics_testing

2) When 'DEBUG = False' in ./wikimetrics/config/db_config.yaml, output is:

INFO  [alembic.migration] Context impl MySQLImpl.
INFO  [alembic.migration] Will assume non-transactional DDL.
Running migration for wikimetrics

This code is performing the action (./database_migrations/env.py):

    config = db.config
    engine = get_engine(config)
    migrations = [(engine, target_metadata)]

    if db.config['DEBUG'] is True:
        test_config = setup_testing_config(deepcopy(config))
        test_engine = get_engine(test_config)
        test_metadata = db.WikimetricsBase.metadata
        migrations.append((test_engine, test_metadata))

I deduce that nothing more needs to be done for this bug.
Comment 2 nuria 2014-10-14 20:33:59 UTC
The catch is that alembic should not be reading ./wikimetrics/config/db_config.yaml but rather /etc/wikimetrics/db_config.yaml unless this second file is not pressent.

Sorry, this should have been spelled out more clearly.
Comment 3 Gerrit Notification Bot 2014-10-15 16:07:49 UTC
Change 166762 had a related patch set uploaded by Mforns:
Use /etc/wikimetrics config files for alembic upgrade

https://gerrit.wikimedia.org/r/166762
Comment 4 Gerrit Notification Bot 2014-10-15 16:19:40 UTC
Change 166762 merged by Milimetric:
Use /etc/wikimetrics config files for alembic upgrade

https://gerrit.wikimedia.org/r/166762

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links