Skip to content

Instantly share code, notes, and snippets.

@sigsergv
Created August 16, 2014 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigsergv/b58634c2fab368f8fe49 to your computer and use it in GitHub Desktop.
Save sigsergv/b58634c2fab368f8fe49 to your computer and use it in GitHub Desktop.
if params is not None:
if isinstance(params, dict):
for key, value in self._process_params_dict(params).items():
stmt = stmt.replace(key, value)
elif isinstance(params, (list, tuple)):
psub = _ParamSubstitutor(self._process_params(params))
stmt = RE_PY_PARAM.sub(psub, stmt)
if psub.remaining != 0:
raise errors.ProgrammingError(
"Not all parameters were used in the SQL statement")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment