ProgrammingError | Python 3.8.10: /usr/bin/python3 Fri Dec 8 04:55:37 2023 |
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/home/cryan/secure_html/daily/index.py in <module> |
91 |
92 myConnection = mysql.connector.connect( host=hostname, user=username, passwd=password, db=database ) |
=> 93 content,promo,maincategory,headerimage = doQuery( myConnection ) |
94 myConnection.close() |
95 |
content undefined, promo undefined, maincategory undefined, headerimage undefined, doQuery = <function doQuery>, myConnection = <mysql.connector.connection_cext.CMySQLConnection object> |
/home/cryan/secure_html/daily/index.py in doQuery(conn=<mysql.connector.connection_cext.CMySQLConnection object>) |
70 # print(query) |
71 |
=> 72 cur.execute( query ) |
73 records = cur.fetchall() |
74 for row in records: |
cur = <mysql.connector.cursor_cext.CMySQLCursor object>, cur.execute = <bound method CMySQLCursor.execute of <mysql.connector.cursor_cext.CMySQLCursor object>>, query = 'select blogcategory.date, blogcategory.title, co... = 6 and YEAR(postdate) = order by postdate DESC' |
/home/cryan/.local/lib/python3.8/site-packages/mysql/connector/cursor_cext.py in execute(self=<mysql.connector.cursor_cext.CMySQLCursor object>, operation='select blogcategory.date, blogcategory.title, co... = 6 and YEAR(postdate) = order by postdate DESC', params=(), multi=False) |
328 |
329 try: |
=> 330 result = self._cnx.cmd_query( |
=> 331 stmt, |
=> 332 raw=self._raw, |
result undefined, self = <mysql.connector.cursor_cext.CMySQLCursor object>, self._cnx = <weakproxy at 0x7f88d61d03b0 to CMySQLConnection>, self._cnx.cmd_query = <bound method CMySQLConnection.cmd_query of <mys...nnector.connection_cext.CMySQLConnection object>>, stmt = b'select blogcategory.date, blogcategory.title, ...= 6 and YEAR(postdate) = order by postdate DESC', raw undefined, self._raw = False, buffered undefined, self._buffered = False, raw_as_string undefined, self._raw_as_string = False |
/home/cryan/.local/lib/python3.8/site-packages/mysql/connector/connection_cext.py in cmd_query(self=<mysql.connector.connection_cext.CMySQLConnection object>, query=b'select blogcategory.date, blogcategory.title, ...= 6 and YEAR(postdate) = order by postdate DESC', raw=False, buffered=False, raw_as_string=False) |
617 ) |
618 except MySQLInterfaceError as err: |
=> 619 raise get_mysql_exception( |
=> 620 err.errno, msg=err.msg, sqlstate=err.sqlstate |
=> 621 ) from err |
global get_mysql_exception = <function get_mysql_exception>, err undefined, msg undefined, sqlstate undefined |
ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by postdate DESC' at line 1
args =
(1064, "1064 (42000): You have an error in your SQL synt...ax to use near 'order by postdate DESC' at line 1", '42000')
errno =
1064
msg =
"You have an error in your SQL syntax; check the ...ax to use near 'order by postdate DESC' at line 1"
sqlstate =
'42000'
with_traceback =
<built-in method with_traceback of ProgrammingError object>