otp.utils.render_otq#
- class render_otq(path, image_path=None, output_format=None, load_external_otqs=True, view=False, line_limit=(10, 30), parse_eval_from_params=False, debug=False)#
Bases:
Render queries from .otq files.
- Parameters
path (str, List[str]) – Path to .otq file or list of paths to multiple .otq files. Needed to render query could be specified with the next format: path_to_otq::query_name
image_path (str, None) – Path for generated image. If omitted, image will be saved in a temp dir
output_format (str, None) – Graphviz rendering format. Default: png. If image_path contains one of next extensions, output_format will be set automatically: png, svg, dot.
load_external_otqs (bool) – If set to True (default) dependencies from external .otq files (not listed in path param) will be loaded automatically.
view (bool) – Defines should generated image be showed after render.
line_limit (Tuple[int, int], None) – Limit for maximum number of lines and length of some EP parameters strings. First param is limit of lines, second - limit of characters in each line. If set to None limit disabled. If one of tuple values set to zero the corresponding limit disabled.
parse_eval_from_params (bool) – Enable parsing and printing eval sub-queries from EP parameters.
debug (bool) – Allow to print stdout or stderr from Grapthviz render.
- Return type
Examples
Render single file:
>>> otp.utils.render_otq("./test.otq")
Render multiple files:
>>> otp.utils.render_otq(["./first.otq", "./second.otq"])
Render specific queries from multiple files:
>>> otp.utils.render_otq(["./first.otq", "./second.otq::some_query"])