Bug 1298066

Summary: not compatible with SQLAlchemy 1.0: AttributeError: 'SQLiteCompiler' object has no attribute '_get_colparams'
Product: [Retired] Beaker Reporter: Dan Callaghan <dcallagh>
Component: generalAssignee: Roman Joost <rjoost>
Status: CLOSED CURRENTRELEASE QA Contact: Dan Callaghan <dcallagh>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: developCC: dcallagh, mjia, rjoost
Target Milestone: 23.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-07 23:12:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Callaghan 2016-01-13 06:37:55 UTC
F23+ plus has SQLAlchemy 1.0. Unit tests fail like this:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 209, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 292, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 315, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose/util.py", line 471, in try_run
    return func()
  File "/builddir/build/BUILD/beaker-23.0.git.0.fba885c/Server/bkr/server/tests/__init__.py", line 19, in setup_package
    data_setup.setup_model()
  File "/builddir/build/BUILD/beaker-23.0.git.0.fba885c/Server/bkr/server/tests/data_setup.py", line 56, in setup_model
    user_email_address=ADMIN_EMAIL_ADDRESS)
  File "/builddir/build/BUILD/beaker-23.0.git.0.fba885c/Server/bkr/server/tools/init.py", line 67, in populate_db
    user = User.lazy_create(user_name=user_name.decode('utf8'))
  File "/builddir/build/BUILD/beaker-23.0.git.0.fba885c/Server/bkr/server/model/base.py", line 59, in lazy_create
    unique_params, extra_params))
  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/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1003, in _execute_clauseelement
    inline=len(distilled_params) > 1)
  File "<string>", line 1, in <lambda>
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 494, in compile
    return self._compiler(dialect, bind=bind, **kw)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 500, in _compiler
    return dialect.statement_compiler(dialect, self, **kw)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 392, in __init__
    Compiled.__init__(self, dialect, statement, **kwargs)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 190, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 213, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 413, in <lambda>
    lambda *arg, **kw: existing(*arg, **kw))
  File "/usr/lib64/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 451, in __call__
    return fn(element, compiler, **kw)
  File "/builddir/build/BUILD/beaker-23.0.git.0.fba885c/Server/bkr/server/model/sql.py", line 30, in visit_conditional_insert
    colparams = compiler._get_colparams(element)
AttributeError: 'SQLiteCompiler' object has no attribute '_get_colparams'

Comment 1 Roman Joost 2016-01-15 05:00:16 UTC
Patch available:

http://gerrit.beaker-project.org/4589

The tricky thing with this is, that we're using private methods in order to create the SQL statements. The private method has been moved to a function in a separate module from SQLAlchemy 1.0 onwards.

The patch basically assumes we're running SQLAlchemy 1.0 already and if it fails importing the module fails back to pre 1.0 behaviour, calling the private methods on the compiler instance.

Comment 3 Dan Callaghan 2016-04-05 11:02:35 UTC
Marking this as VERIFIED based on the fact that the Fedora 23/rawhide unit tests (which is where we originally saw this problem) are passing with this patch.

We are *not* planning a migration to SQLAlchemy 1.0 in the near future, and we aren't expecting everything to actually work necessarily on SQLAlchemy 1.0, so there is no need for us to actually test Beaker fully against 1.0. Just the passing tests is enough for now.

Comment 4 Dan Callaghan 2016-07-07 23:12:05 UTC
Beaker 23.0 has been released.