MCPcopy Index your code
hub / github.com/andialbrecht/sqlparse / format

Function format

sqlparse/__init__.py:51–65  ·  view source on GitHub ↗

Format *sql* according to *options*. Available options are documented in :ref:`formatting`. In addition to the formatting options this function accepts the keyword "encoding" which determines the encoding of the statement. :returns: The formatted SQL statement as string.

(sql: str, encoding: Optional[str] = None, **options: Any)

Source from the content-addressed store, hash-verified

49
50
51def format(sql: str, encoding: Optional[str] = None, **options: Any) -> str:
52 """Format *sql* according to *options*.
53
54 Available options are documented in :ref:`formatting`.
55
56 In addition to the formatting options this function accepts the
57 keyword "encoding" which determines the encoding of the statement.
58
59 :returns: The formatted SQL statement as string.
60 """
61 stack = engine.FilterStack()
62 options = formatter.validate_options(options)
63 stack = formatter.build_filter_stack(stack, options)
64 stack.postprocess.append(filters.SerializerUnicode())
65 return "".join(stack.run(sql, encoding))
66
67
68def split(

Callers

nothing calls this directly

Calls 1

runMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…