literal_binds parameter not applied to LIMIT clause

Issue #3239 duplicate
Craig Radcliffe created an issue

I noticed this issue while trying to use sqlalchemy as a query generator to produce a string for input into a system that doesn't accept bind parameters.

The literal_binds parameter, when passed through the compile_kwargs parameter in the compile() method, does not seem to apply to a LIMIT clause. Here is a basic example:

from sqlalchemy import select
from sqlalchemy.sql import table, literal_column


t = table("foo")
t.append_column(literal_column("bar"))
print select([t.c["bar"]]).limit(100).compile(compile_kwargs={'literal_binds': True})

The output is:

#!
SELECT foo.bar 
FROM foo
 LIMIT :param_1

I would expect:

#!

SELECT foo.bar 
FROM foo
 LIMIT 100

Other clauses, including JOINs, WHEREs, GROUP BYs, etc. work as expected.

The issue is present in 0.9.8.

Comments (2)

  1. Log in to comment