<div dir="ltr">I started getting this error when I switched from msqlite to MariaDB on a digital ocean droplet. The syntax of how the ORM generates the query seems to be the problem, but I don't know how to fix it. Changing the paginate parameters such as 'per_page' only makes the params show as '-20, 20', for example. See the error below:<br><br>sqlalchemy.exc.ProgrammingError<br><br>ProgrammingError: (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-10, 10' at line 3")<br><br>[SQL: u'SELECT <a href="http://post.id">post.id</a> AS post_id, post.title AS post_title, post.text AS post_text, post.publish_date AS post_publish_date, post.user_id AS post_user_id \nFROM post ORDER BY post.publish_date DESC \n LIMIT %(param_1)s, %(param_2)s'] [parameters: {u'param_1': -10, u'param_2': 10}]<br><br>Here is the line that queries for posts:<br><br>@blog_blueprint.route('/')<br>@blog_blueprint.route('/<int:page>')<br>@cache.cached(timeout=60)<br>def home(page=1):<br>    posts = Post.query.order_by(Post.publish_date.desc()).paginate(page, 10)<br>    recent, top_tags = sidebar_data()<br><br>    return render_template(<br>    'home.html',<br>    posts=posts,<br>    recent=recent,<br>    top_tags=top_tags<br>    )<br><br>This first query fails with that same error, the second works via CLI, so this seems to be what flask is sending to MySQL:<br><br>MariaDB [flaskblog]> SELECT <a href="http://post.id">post.id</a> AS post_id, post.title AS post_title,<br>post.text AS post_text, post.publish_date AS post_publish_date, post.user_id<br>AS post_user_id \n FROM post ORDER BY post.publish_date DESC LIMIT -10, 10;<br><br>MariaDB [flaskblog]> SELECT <a href="http://post.id">post.id</a> AS post_id, post.title AS post_title,<br>post.text AS post_text, post.publish_date AS post_publish_date, post.user_id<br>AS post_user_id \n FROM post ORDER BY post.publish_date DESC LIMIT 0, 10;<div><br></div><div>I am about to just take pagination out, because it's my first flask project and it's just a blog, but I have spent hours banging my head. Thanks!</div><div><br></div><div>Scott</div></div>