[web2py] Create name for additional column in query

2019-10-15 Thread Константин Комков
I have that query: sumAuditorHours = db.a_wlp2_distrib.LC_HOURS + db.a_wlp2_distrib.SM_HOURS + db.a_wlp2_distrib.LB_HOURS subjects = db((db.a_groups.id == group) & (db.a_wlp2_distrib.MODULE == module) & (db.a_wlp2.PARENT_ITEM != None)).select(db.s_disc_names.id,db.s_disc_names.FULL_NAME,db.a_wlp

Re: [web2py] Create name for additional column in query

2019-10-15 Thread Massimiliano
fields = [db.s_disc_names.id.with_alias('id'), db.s_disc_names.FULL_NAME-with_alias('full_name'), db.a_wlp2.CHAIR.with_alias('chair') ] subjects = db((db.a_groups.id == group) & (db.a_wlp2_distrib.MODULE == module) & (db.a_wlp2.PARENT_ITEM != None)).select(*fields, ...

Re: [web2py] Re: py4web - will it inherit web2py structures ?

2019-10-15 Thread 'graham' via web2py-users
Thanks Massimo, that will probably sort it out, I've had a quick look at bottle and should be able to amend the code appropriately. I'll post again when it appears to be working, which, hopefully, won't be very long graham On Tuesday, October 15, 2019, 3:38:48 AM GMT+1, Massimo Di Pierr

[web2py] Error upload file csv database

2019-10-15 Thread Kimus
Hello !!! I need help , I have four tables in DB, but I migrate for other domin so i have put the datas in DB new, but exist error foreign key incompaltible this ocorred because when upload file example auth_user the column ID is modificate for other number diferents the table original some

Re: [web2py] Create name for additional column in query

2019-10-15 Thread Massimiliano
Sorry I miss a piece: sumAuditorHours = (db.a_wlp2_distrib.LC_HOURS + db.a_wlp2_distrib.SM_HOURS + db.a_wlp2_distrib.LB_HOURS) fields = [db.s_disc_names.id.with_alias('id'), db.s_disc_names.FULL_NAME-with_alias('full_name'), db.a_wlp2.CHAIR.with_alias('chair'), sumAud

Re: [web2py] Create name for additional column in query

2019-10-15 Thread Константин Комков
No problem, I understand that I need to use with_alias('my_column_name'). Thank you! вт, 15 окт. 2019 г., 18:04 Massimiliano : > Sorry I miss a piece: > > sumAuditorHours = (db.a_wlp2_distrib.LC_HOURS + db.a_wlp2_distrib.SM_HOURS > + db.a_wlp2_distrib.LB_HOURS) > fields = [db.s_disc_names.id.with

[web2py] multi tables count

2019-10-15 Thread Patito Feo
Hi, Ive been trying many ways of getting this right, db.define_table('pedidos', Field('fecha', type='date' ), Field('cliente', ), Field('pares', ), Field('estado', ), Field('noitems', ), Field('notape

Re: [web2py] multi tables count

2019-10-15 Thread Massimiliano
I don't understand exactly what you mean, but maybe, you want to count itemspedidos.id grouping by [db.pedidos.fecha.month(), db.itemspedidos.COD_REFE] rows=db( (db.pedidos.fecha.year() == '2019' )&( db.itemspedidos.COD_PEDI == db.pedidos.id )).select( db.itemspedidos.COD_REFE, db.itemspedidos.id.

Re: [web2py] multi tables count

2019-10-15 Thread Patito Feo
Well, I just tried your reply and it works. I didnt know i was able to groupby mutiple fields and the count should be the id. One complete week stuck in this. Thanks a lot. El martes, 15 de octubre de 2019, 15:52:25 (UTC-5), Massimiliano escribió: > > I don't understand exactly what you mea

[web2py] Re: About response.toolbar

2019-10-15 Thread Massimo Di Pierro
Those are queries made by your app to the database within the same request that serves the toolbar. This looks like a registration page because of INSERT in auth_user. It does make a lot of select. you may want to simplify your code and use caching, else this page is going to be very slow. I do

[web2py] Re: Error upload file csv database

2019-10-15 Thread Massimo Di Pierro
Do you have the original database. If you do you should export it from the web2py shell with db.export_to_csv_file and reimport it with db.import_from_csv_file. This is documented in the manual. The import will automatically fix your keys. If you use postgres you can use pgdump and pgrestore.

Re: [web2py] db.import_from_csv_file in python3

2019-10-15 Thread Massimo Di Pierro
Can you please open a pydal ticket? I can fix this over the week-end. On Monday, 14 October 2019 01:54:41 UTC-7, Mamisoa Andriantafika wrote: > > It seems to be related with the "blob" type where python 2 accept also > string type while python 3 expect byte type. > > When I delete the row which c