Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
op_type = SQLOperationType.INSERT_RETURNING
query_name = query_name[:-2]
elif query_name.endswith("*!"):
op_type = SQLOperationType.INSERT_UPDATE_DELETE_MANY
query_name = query_name[:-2]
elif query_name.endswith("!"):
op_type = SQLOperationType.INSERT_UPDATE_DELETE
query_name = query_name[:-1]
elif query_name.endswith("#"):
op_type = SQLOperationType.SCRIPT
query_name = query_name[:-1]
else:
op_type = SQLOperationType.SELECT
if not valid_query_name_pattern.match(query_name):
raise SQLParseException(f'name must convert to valid python variable, got "{query_name}".')
docs = ""
sql = ""
for line in lines[1:]:
match = doc_comment_pattern.match(line)
if match:
docs += match.group(1) + "\n"
else:
sql += line + "\n"
docs = docs.strip()
sql = driver_adapter.process_sql(query_name, op_type, sql.strip())
return _create_fns(query_name, docs, op_type, sql, driver_adapter)