[web2py] Re: Help with an error:
On Wednesday, August 15, 2018 at 4:57:29 PM UTC-4, Morganti wrote: > > Hi Anthony, > > I created a new field and migrated the values to this new one. It´s normal > now. > > The "valor" field was numeric. > Note, if you are using SQLite and initially created the "valor" field as type "string", then subsequently changing the type to a numeric type would have no effect, as you cannot change column types in SQLite. You must instead create a whole new field and migrate the data, which you have now done. Anthony -- 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. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Help with an error:
Hi Anthony, I created a new field and migrated the values to this new one. It´s normal now. The "valor" field was numeric. Thanks your helping Best regards André Em terça-feira, 14 de agosto de 2018 21:57:53 UTC-3, Anthony escreveu: > > What is your model definition? Is "valor" a numeric field? > > On Tuesday, August 14, 2018 at 8:13:44 PM UTC-4, Morganti wrote: >> >> Hi guys, >> >> I am having the error below: >> >> Número do Ticket >> >> 187.122.40.48.2018-08-14.20-50-49.b4d5d6f0-071d-4f6b-aec3-1c662eb5ea0c >> function sum(character varying) does >> not exist LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE >> ((("ov_ho... ^ HINT: No function matches the given name and argument types. >> You might need to add explicit type casts.Versão >> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25 >> Python Python 2.7.12: /home/www-data/py27env/bin/uwsgi (prefix: >> /home/www-data/py27env)Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> 17. >> 18. >> 19. >> 20. >> 21. >> 22. >> 23. >> 24. >> 25. >> 26. >> 27. >> >> Traceback (most recent call last): >> File "/home/www-data/py27env/web2py/gluon/restricted.py", line 219, in >> restricted >> exec(ccode, environment) >> File >> "/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py", >> line 530, in >> File "/home/www-data/py27env/web2py/gluon/globals.py", line 419, in >> >> self._caller = lambda f: f() >> File >> "/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py", >> line 320, in bonus_area >> File >> "/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py", >> line 1367, in gera_bonus_area >> File >> "/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py", >> line 1422, in total_venda_home >> File "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/objects.py", >> line 2250, in select >> return adapter.select(self.query, fields, attributes) >> File >> "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 762, in select >> return self._select_aux(sql, fields, attributes, colnames) >> File >> "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 718, in _select_aux >> rows = self._select_aux_execute(sql) >> File >> "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 712, in _select_aux_execute >> self.execute(sql) >> File >> "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/__init__.py", >> line 67, in wrap >> return f(*args, **kwargs) >> File >> "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 412, in execute >> rv = self.cursor.execute(command, *args[1:], **kwargs) >> ProgrammingError: function sum(character varying) does not exist >> LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE ((("ov_ho... >>^ >> HINT: No function matches the given name and argument types. You might need >> to add explicit type casts. >> >> >> The code that is getting this error is: >> >> total = db.ov_home.valor.sum() >> total_venda = db( >> (db.ov_home.home_id == home_id) & >> (db.ov_home.data_ordem.year() == ano) & >> (db.ov_home.data_ordem.month() == mes) >> ).select(total).first()[total] >> >> I think I am using nothing out of normal, isn´t it? >> >> Thanks your helping >> André >> > -- 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. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Help with an error:
What is your model definition? Is "valor" a numeric field? On Tuesday, August 14, 2018 at 8:13:44 PM UTC-4, Morganti wrote: > > Hi guys, > > I am having the error below: > > Número do Ticket > > 187.122.40.48.2018-08-14.20-50-49.b4d5d6f0-071d-4f6b-aec3-1c662eb5ea0c > function sum(character varying) does > not exist LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE > ((("ov_ho... ^ HINT: No function matches the given name and argument types. > You might need to add explicit type casts.Versão > web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25 > Python Python 2.7.12: /home/www-data/py27env/bin/uwsgi (prefix: > /home/www-data/py27env)Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > 14. > 15. > 16. > 17. > 18. > 19. > 20. > 21. > 22. > 23. > 24. > 25. > 26. > 27. > > Traceback (most recent call last): > File "/home/www-data/py27env/web2py/gluon/restricted.py", line 219, in > restricted > exec(ccode, environment) > File > "/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py", > line 530, in > File "/home/www-data/py27env/web2py/gluon/globals.py", line 419, in > self._caller = lambda f: f() > File > "/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py", > line 320, in bonus_area > File > "/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py", > line 1367, in gera_bonus_area > File > "/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py", > line 1422, in total_venda_home > File "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/objects.py", > line 2250, in select > return adapter.select(self.query, fields, attributes) > File > "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 762, in select > return self._select_aux(sql, fields, attributes, colnames) > File > "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 718, in _select_aux > rows = self._select_aux_execute(sql) > File > "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 712, in _select_aux_execute > self.execute(sql) > File > "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/__init__.py", > line 67, in wrap > return f(*args, **kwargs) > File > "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 412, in execute > rv = self.cursor.execute(command, *args[1:], **kwargs) > ProgrammingError: function sum(character varying) does not exist > LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE ((("ov_ho... >^ > HINT: No function matches the given name and argument types. You might need > to add explicit type casts. > > > The code that is getting this error is: > > total = db.ov_home.valor.sum() > total_venda = db( > (db.ov_home.home_id == home_id) & > (db.ov_home.data_ordem.year() == ano) & > (db.ov_home.data_ordem.month() == mes) > ).select(total).first()[total] > > I think I am using nothing out of normal, isn´t it? > > Thanks your helping > André > -- 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. For more options, visit https://groups.google.com/d/optout.