Skip to content

query_graph fails with duckdb 2 #752

Open

Description

@gishor

What happens?

We used to be able to run this to get a visualization of the duckdb profiling. It's still mentioned in the documentation: https://duckdb.org/docs/2.0/dev/profiling#query-graphs

But it doesn't work anymore with duckdb 2. #494 says that query_graph is broken but will be fixed before v2.0. I don't think that happened. Are there plans to fix it?

To Reproduce

First run this with duckdb 2:

SET enable_profiling='json';
SET profile_output = '/tmp/profile.json';
SELECT 1;
 python -m duckdb.query_graph --profile_input /tmp/profile.json
<frozen runpy>:130: RuntimeWarning: 'duckdb.query_graph.__main__' found in sys.modules after import of package 'duckdb.query_graph', but prior to execution of 'duckdb.query_graph.__main__'; this may result in unpredictable behaviour
Traceback (most recent call last):
  File "<frozen runpy>", line 203, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 672, in <module>
    main()
    ~~~~^^
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 665, in main
    profiling_info.to_html(output_file=output)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 339, in to_html
    html_output = self._translate_json_to_html(input_text=profiling_info_text, output_file=output_file)
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 594, in _translate_json_to_html
    highlight_metric_grid = self._generate_metric_grid_html(text)
  File ".venv/lib/python3.13/site-packages/duckdb/query_graph/__main__.py", line 505, in _generate_metric_grid_html
    "Execution Time (s)": f"{float(json_graph.get('latency', 'N/A')):.4f}",
                             ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'N/A'

OS:

mac arm

DuckDB Package Version:

2.0.0

Python Version:

2.0.0

Full Name:

Gishor Sivanrupan

Affiliation:

Exaforce

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • Yes, I have
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions