I'm at testing stage, so sqlite, with plans to move over to postgresql, which I discovered to handle such nonexistent dates similarly.
Yes I can do a select on fields that do not have dates. On Friday, March 17, 2017 at 8:15:10 AM UTC+8, Dave S wrote: > > > > On Thursday, March 16, 2017 at 3:59:47 PM UTC-7, lyn2py wrote: >> >> >> I've loaded a bunch of data into the DB, and some of the tables and rows >> has the datetime field "0000-00-00" >> >> That caused web2py admin > this app's database to raise an error because >> of the datetime field: >> "year is out of range" >> >> > > Which database are you using? > > >> (1) I tried to use filter_out on the field but it is not working. What >> can I do for this error? >> >> def filter_out_datetime(table, fields): >> def check_datetime(self, dt): >> if dt=='0000-00-00 00:00:00': >> return '' >> else: >> return dt >> for field in fields: >> db[table][field].filter_out = lambda val, cdt=check_datetime: cdt(val) >> >> (2) Is there a way to retrieve all fields of "datetime" type in web2py? I >> have a number of such fields across the many tables. And may be adding >> more... >> >> (3) How do I use SQLCustomType for this use case? >> >> >> Thank you! >> > > Can you do a select where you request only the fields that are *not* > supposed to have dates (a name field, for instance)? > > /dps > > > -- 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.