The problem is that I had not installed pyodbc (I use MS SqlServer) and I was using some version of the web2py itself.
Installing pyodbc works fine El jueves, 2 de diciembre de 2021 a las 11:39:39 UTC-3, Jose escribió: > I add something. If instead of making select * from MyView I doselect > MyField, AnotherFiel from MyView > > works in this way I create the dictionary with equal keys to the first > letter of each field in lowercase > > [{'m': 6, 'a': 'xxxxxx'}] > > Jose > > El jueves, 2 de diciembre de 2021 a las 11:30:37 UTC-3, Jose escribió: > >> >> Something else if I make select * from myView I get >> >> RuntimeError: Result set includes duplicate column names. Specify unique >> column names using the 'colnames' argument >> >> but I do not have duplicate fields >> >> El jueves, 2 de diciembre de 2021 a las 11:15:40 UTC-3, Jose escribió: >> >>> If I do not define colnames I get >>> >>> rows[0]['MyField'] >>> KeyError: 'MyField' >>> >>> El jueves, 2 de diciembre de 2021 a las 9:15:46 UTC-3, Jose escribió: >>> >>>> I'm migrating an old app that runs in an old version of web2py in >>>> python27. In a lot of places I use db.executesql with argument >>>> as_dict=True. The error that I am getting is that he asks me to define the >>>> colnames que es un nuevo argumento. >>>> >>>> Sometimes SQL is a query to views and others to stored procedures >>>> >>>> >>>> If I pass a list with the names of the fields it works, but it is >>>> something I want to avoid. >>>> >>>> rows = db.executesql(_sql, as_dict=True, colnames=['MyField']) # This >>>> works fine >>>> >>>> Is there any way to avoid the list with the names of the fields? >>>> >>>> Jose >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/babadf17-3674-462c-a9a9-66d9fd14e298n%40googlegroups.com.