Serhiy Storchaka added the comment: The expression is a concatenation of f-string expression f"SELECT COUNT(*) " and three string literals. If you want to substitute the "a" value, convert string literals into f-string expressions:
query = (f"SELECT COUNT(*) " f"FROM `{a}` entry " f"WHERE entry.type == 'device' " f"AND entry.instance == {a}") or query = ("SELECT COUNT(*) " f"FROM `{a}` entry " "WHERE entry.type == 'device' " f"AND entry.instance == {a}") But be aware that using f-string expressions for formatting SQL queries is not safe in general case. Instead, use the DB-API’s parameter substitution. ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29668> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com