Use my own bindparam for Query.limit()
I am trying to use the "baked query" pattern to reduce the time spent generating SQL, which currently is quite significant for our app.
One thing I can't seem to parameterize using a bindparam, however, is the limit on the query.
#805 the limit was changed into a bindparam, this doesn't allow me to provide my own bindparam but rather always creates its own bindparam, assuming the limit I procide is a number already.
I think that if the places where currently it wraps a numeric limit into a bindparam using sql.literal() it would also check if limit was already a bindparam then it would be good.
Here's an example that can be pasted into the test suite:
def test_select_with_bindparam_limit(self): """Does a query allow bindparam for the limit?""" sess = create_session() users =  q1 = sess.query(self.classes.User).order_by(self.classes.User.id).limit(sa.bindparam('n')) for n in xrange(1,4): users[:] = q1.params(n=n).all() assert len(users) == n