'asyncpg.exceptions._base.InterfaceError: the server expects 1 argument for this query, 2 were passed
I want to delete element from array in this code
async def delete_title(self, telegram_id, array):
sql = "UPDATE Users SET title_id_list=(SELECT array(SELECT unnest(title_id_list) EXCEPT SELECT unnest('{$2}'::VARCHAR[]))) WHERE telegram_id=$1"
return await self.execute(sql, telegram_id, array, execute=True)
Solution 1:[1]
Recently faced the same issue: the source was colon+character sequence (in your case it's ('{$2}'::VARCHAR[])))), sqlalchemy is escaping such string when initializing query and reading it as an input parameter - https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.text.
Possible solution: you should replace : with \:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
