i started developing my app with aiopg to access data in postgres and everything was OK , i decided to replace it with asyncpg .
this is one of my view function :
@router.get('/{post}')
@aiohttp_jinja2.template("view.html")
async def view_post(request):
ret = {'id':'1','owner':'shooooobi','editor':'shooooobi','title':'new_title','text':'nothing'}
return {"post":ret}
it is a simple view and is ok but when i added some asyncpg code like following ,i added line 4 to 7 line by line and run app ...
@router.get('/{post}')
@aiohttp_jinja2.template("view.html")
async def view_post(request):
pg = request.config_dict["PG"]
post_id = request.match_info["post"]
con = pg.acquire()
cur = con.cursor('SELECT id, owner, editor, title, text FROM mshma.posts where id=$1',post_id)
ret = {'id':'1','owner':'shooooobi','editor':'shooooobi','title':'new_title','text':'nothing'}
return {"post":ret}
line 7 cause that i received following text in my web page.
context should be mapping, not <class 'set'>
when i comment this line (line 7) my view function works as expected . what is the problem??