MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / clean_sql

Function clean_sql

bmtools/tools/database/utils/db_utils.py:13–18  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

11 return re.sub(r'(table|TABLE).+?\(.+?\)\s*;','',sql, flags=re.DOTALL)
12
13def clean_sql(sql):
14 tmp = []
15 for token in sql.flatten():
16 if not token.is_whitespace and not token.ttype is sqlparse.tokens.Comment.Single:
17 tmp.append(token)
18 return strip_par(' '.join(str(t) for t in tmp))
19
20def strip_par(s):
21 for op in ['(',')',',','>','=','<','>=','<=','!=','<>','.',';']:

Callers 1

preprocess_execute_sqlFunction · 0.70

Calls 1

strip_parFunction · 0.70

Tested by

no test coverage detected