On Sep 8, 11:56 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I think I fixed these. One more try?
>
> On Sep 8, 10:30 am, ron_m <ron.mco...@gmail.com> wrote:

I think the re match still has a problem but it is closer.

The fault is on a key error for "longtext," which should not be trying
to match on the field type including the comma. This the same
description field of type longtext that appears in table auth_event.

  `description` longtext,

$ python scripts/extract_mysql_models.py user:p...@db_name
Traceback (most recent call last):
  File "scripts/extract_mysql_models.py", line 94, in <module>
    print mysql(m.group(3),m.group(1),m.group(2))
  File "scripts/extract_mysql_models.py", line 80, in mysql
    web2py_table_code += "\n    Field('%s','%s'),"%
(name,data_type_map[d_type])
KeyError: 'longtext,'

Looks like the second (\S+) also pulled in the comma after longtext

                hit = re.search('(\S+)\s+(\S+)( .*)?', line)

I added a print name, d_type just before the failure line and got this
output
`id` int(11)
`time_stamp` datetime
`client_ip` varchar(512)
`user_id` int(11)
`origin` varchar(512)
`description` longtext,

Reply via email to