postgressql sql python 中 "convert_from" 处或附近的查询语法错误

postgresql sql query syntax error at or near "convert_from" in python

我认为这是个简单的问题,如何在 python 中编写 sql 查询?

### python3 code
# ok 
row = await conn.fetchrow(
    'SELECT * FROM users WHERE email = ', user_email)

# NOT ok
user_pw = await conn.fetch(                                                          
    'convert_from(, )', row[2], 'UTF8') 

asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "convert_from"

我已经用以下代码修复了我的错误:

tmp_pw = await conn.fetch(
    'SELECT * FROM convert_from(, )', row[2], 'UTF8')

# because, tmp_pw is  
#[<Record convert_from='a$PsXD/oaDXwC1Ffup842I/emQ3Bz26AWjQNsLBQipQ4gvRIFhUQAXb2'>]
# any suggestion is welcome.
user_pw = str(tmp_pw).strip('[]').strip('<>').split('=')[1].strip('\'')

# another method to get pw from Record (not tested):
# tmp_iter = iter(tmp_pw)
# user_pw = next(tmp_iter)