Skip to content

Commit

Permalink
fixed sqlite create table parse regex
Browse files Browse the repository at this point in the history
At least SQLite 3.8.6 uses the format:

[item]        type,
[item]        type,
[item]        type,

The previous variant tried to parse lines like:

"item"        type,
"item"        type,
"item"        type,
  • Loading branch information
sven committed Feb 20, 2015
1 parent 8d83bb3 commit 11c90ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/extract_sqlite_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def sqlite(database_name):
for line in sql_lines[1:-1]:
if re.search('KEY', line) or re.search('PRIMARY', line) or re.search('"ID"', line) or line.startswith(')'):
continue
hit = re.search(r'"(\S+)"\s+(\w+(\(\S+\))?),?( .*)?', line)
hit = re.search(r'\[(\S+)\]\s+(\w+(\(\S+\))?),?( .*)?', line)
if hit is not None:
name, d_type = hit.group(1), hit.group(2)
d_type = re.sub(r'(\w+)\(.*', r'\1', d_type)
Expand Down

0 comments on commit 11c90ef

Please sign in to comment.