On Apr 1, 11:17 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > Got it. Thanks. > > So lets repeat some steps to see how this happened. > > Production Database > -> Open appadmin: Everything OK. > -> print db(db.category.id > 0).select(orderby=~db.category.id).first() > category.id -> 4059 # this is the highest category in databases > category.name -> "sports" > -> db.export_to_csv_file(open('/tmp/dumps.csv', 'w')) > > mv /tmp/dumps.csv -> local://home/dumps.csv > > Local Environment > -> Delete everything under databases. > -> Refresh appadmin > -> db.import_from_csv_file(open('/home/dumps.csv', 'r'))
export / import use csv.reader / csv.writer --- DAL import_from_csv_file calls Table import_from_csv_file --- you should look at how these setup, and if that's causing the problem. The table ID's triy to be re-numbered - it might be that a reference is being missed (if you have a reference field defined as an integer, I would suspec that - otherwise, might be a bug in the way the import happens). Basically - look at the csv file manually, and then try to find the reference that is potentially causing you the problem - figure it out, and fix it (I know that's not helpful in itself, but that's the level you need to look at, at this point). - Yarko > -> Refresh appadmin > -> Raises -> Undefined Exception -> get record id. > -> bad_reference = db(db.category.parent == bad_record_id).select() > -> len(bad_reference) = 1 > -> print bad_reference.parent == 4057 > -> print db(db.category.id > 0).select(orderby=~db.category.id).first() > category.id -> 4053 # this is the highest category in databases > category.name -> "sports" > > Am I missing something here or doing something wrong? > > -Thadeus > > On Thu, Apr 1, 2010 at 10:05 AM, Yarko Tymciurak > > <resultsinsoftw...@gmail.com> wrote: > > I'd first (quickly) try: save table (or tables) as csv, then grep > > 4057 to see where it shows up, and work from there. > > > - Yarko > > > On Apr 1, 10:56 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > >> Yes but out of 4050 records, how do I determine the one record that > >> got borked, since obviously record 4057 does not exist. I have queried > >> reference fields and nothing refers to a record 4057 either. > > >> p.s. this was with using sqlite browser > > >> -Thadeus > > >> On Thu, Apr 1, 2010 at 9:53 AM, Yarko Tymciurak > > >> <resultsinsoftw...@gmail.com> wrote: > >> > On Apr 1, 9:52 am, Thadeus Burgess <thade...@thadeusb.com> wrote: > >> >> Somehow, I am getting the "Undefined Record Exception" being raised, > >> >> from line 1429 in sql.py. > > >> >> When I comment out the exception, appadmin works just fine. It looks > >> >> as if the reference is an ID that does not exist in my table. > > >> > ... implied: NOT a clean install.... > > >> >> Somehow, the ID is 4057, when the highest ID in my table is only 4052, > >> >> any ideas on how this could have happened, or how to even fix this!? > > >> > Guess: has to do with your table references.... > > >> > .... for action in [debuggin, info]: provide action > > >> > ;-) > > >> > - Yarko > > >> >> -Thadeus > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "web2py-users" group. > >> > To post to this group, send email to web...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > web2py+unsubscr...@googlegroups.com. > >> > For more options, visit this group > >> > athttp://groups.google.com/group/web2py?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.