TypeError: 'int' object is not subscriptable Python SQL

Viewed 26

I have a query to get a number of total records:

update_query = 'select count(*) from table where update_count > 0'

when I use:

query = db_connection.execute(update_query)
query_result = query.fetchone()

it gives this error:

TypeError: 'int' object is not subscriptable

The result should be a number, so I should use fetchone not fetchall, but why this happened?

0 Answers
Related