[Sqlalchemy-tickets] Issue #3038: compilers that apply binds in select precolumns can be out of syn
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2014-04-30 22:54:00
|
New issue 3038: compilers that apply binds in select precolumns can be out of sync with column-nested subqueries https://bitbucket.org/zzzeek/sqlalchemy/issue/3038/compilers-that-apply-binds-in-select Mike Bayer: e.g. firebird, sql server, others: ``` #!python from sqlalchemy import * from sqlalchemy.sql import column, literal s1 = select([column('x')]).select_from('a').limit(5).as_scalar() s2 = select([s1]).limit(10) from sqlalchemy.engine import default from sqlalchemy.sql import compiler class MyCompiler(compiler.SQLCompiler): def get_select_precolumns(self, select): result = "" if select._limit: result += "FIRST %s " % self.process(literal(select._limit)) if select._offset: result += "SKIP %s " % self.process(literal(select._offset)) return result def limit_clause(self, select): return "" dialect = default.DefaultDialect() dialect.statement_compiler = MyCompiler dialect.paramstyle = 'qmark' dialect.positional = True compiled = s2.compile(dialect=dialect) assert \ [compiled.params[name] for name in compiled.positiontup] == [10, 5] ``` |