Bug 1465511 - Pagure 2.90.1 createdb.py gives sqlalchemy.exc.OperationalError
Pagure 2.90.1 createdb.py gives sqlalchemy.exc.OperationalError
Status: NEW
Product: Fedora
Classification: Fedora
Component: pagure (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Pierre-YvesChibon
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-27 10:32 EDT by Paul Jakma
Modified: 2017-06-27 10:32 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Paul Jakma 2017-06-27 10:32:50 EDT
Description of problem:

Running pagure_createdb.py from the pagure 2.90.1 RPM package from koji (on F25), appears to fix bug #1465490. However, it still does not succeed. Rather it errors out with an sqlalchemy.exc.OperationalError.

Version-Release number of selected component (if applicable):

pagure-2.90.1-1.el7.noarch installed on F25

MySQL:

Server version:         10.1.24-MariaDB MariaDB Server


How reproducible:

100%

Steps to Reproduce:
1. Install pagure and pagure-{ev,webhooks} 2.90.1-1.el7
2. Configure DB_URL as per DB_URL='mysql://pagure:blah@127.0.0.1/pagure'
3. Run PAGURE_CONFIG=/etc/pagure/pagure.cfg  python /usr/share/pagure/pagure_createdb.py

Actual results:

<it succeeds in creating many tables, then...>
2017-06-27 14:30:24,391 INFO sqlalchemy.engine.base.Engine 
CREATE TABLE issue_keys (
        id INTEGER NOT NULL AUTO_INCREMENT, 
        project_id INTEGER NOT NULL, 
        name TEXT NOT NULL, 
        key_type VARCHAR(255) NOT NULL, 
        key_data TEXT, 
        key_notify BOOL NOT NULL, 
        CONSTRAINT issue_keys_pkey PRIMARY KEY (id), 
        CONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), 
        CONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, 
        CHECK (key_notify IN (0, 1))
)


2017-06-27 14:30:24,391 [INFO] sqlalchemy.engine.base.Engine: 
CREATE TABLE issue_keys (
        id INTEGER NOT NULL AUTO_INCREMENT, 
        project_id INTEGER NOT NULL, 
        name TEXT NOT NULL, 
        key_type VARCHAR(255) NOT NULL, 
        key_data TEXT, 
        key_notify BOOL NOT NULL, 
        CONSTRAINT issue_keys_pkey PRIMARY KEY (id), 
        CONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), 
        CONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, 
        CHECK (key_notify IN (0, 1))
)


2017-06-27 14:30:24,391 INFO sqlalchemy.engine.base.Engine ()
2017-06-27 14:30:24,391 [INFO] sqlalchemy.engine.base.Engine: ()
2017-06-27 14:30:24,392 INFO sqlalchemy.engine.base.Engine ROLLBACK
2017-06-27 14:30:24,392 [INFO] sqlalchemy.engine.base.Engine: ROLLBACK
Traceback (most recent call last):
  File "/usr/share/pagure/pagure_createdb.py", line 14, in <module>
    debug=True)
  File "/usr/lib/python2.7/site-packages/pagure/lib/model.py", line 76, in create_tables
    BASE.metadata.create_all(engine)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3762, in create_all
    tables=tables)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1856, in _run_visitor
    conn._run_visitor(visitorcallable, element, **kwargs)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1481, in _run_visitor
    **kwargs).traverse_single(element)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
    return meth(obj, **kw)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 730, in visit_metadata
    _is_metadata_operation=True)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
    return meth(obj, **kw)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 764, in visit_table
    include_foreign_key_constraints=include_foreign_key_constraints
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl
    compiled
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, 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 1139, in _execute_context
    context)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 226, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorvalue
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1170, "BLOB/TEXT column 'name' used in key specification without a key length") [SQL: u'\nCREATE TABLE issue_keys (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tproject_id INTEGER NOT NULL, \n\tname TEXT NOT NULL, \n\tkey_type VARCHAR(255) NOT NULL, \n\tkey_data TEXT, \n\tkey_notify BOOL NOT NULL, \n\tCONSTRAINT issue_keys_pkey PRIMARY KEY (id), \n\tCONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), \n\tCONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, \n\tCHECK (key_notify IN (0, 1))\n)\n\n']


Expected results:

I wasn't expecting it to error with sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError).

Additional info:

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