Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions scripts/ilapfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,21 +1015,26 @@ def null_absent_columns(path, query):
return query

replaced = []
for _ in range(50): # a query cannot need more than this
try:
db.execute('EXPLAIN ' + query)
break
except sqlite3.OperationalError as ex:
match = re.match(r'no such column:\s*(\S+)', str(ex))
if not match:
try:
for _ in range(50): # a query cannot need more than this
try:
db.execute('EXPLAIN ' + query)
break
reference = match.group(1)
if reference in replaced:
break # not making progress, leave it alone
replaced.append(reference)
query = _null_out_column(query, reference)
except sqlite3.Error:
break
except sqlite3.OperationalError as ex:
match = re.match(r'no such column:\s*(\S+)', str(ex))
if not match:
break
reference = match.group(1)
if reference in replaced:
break # not making progress, leave it alone
replaced.append(reference)
query = _null_out_column(query, reference)
except sqlite3.Error:
break
finally:
# Artifacts call this once per query, so an unclosed handle here is one
# leak per query for the whole run rather than a one-off.
db.close()

if replaced:
logfunc(f'{os.path.basename(path)}: column(s) absent from this version are reported '
Expand Down
Loading