Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Validation failing when Profile is enabled #653

Closed
brunocostalopes opened this issue Nov 21, 2022 · 1 comment · Fixed by #706
Closed

SQL Validation failing when Profile is enabled #653

brunocostalopes opened this issue Nov 21, 2022 · 1 comment · Fixed by #706
Assignees

Comments

@brunocostalopes
Copy link

Hi, I've recently upgraded from spectacles 2.0.3 to the new 2.3.1.

With 2.3.1 when I use the --profile flag with SQL Validation, I get the following results:

============== Testing 56 explores [fail fast] [concurrency = 10] ==============

............................ Query profiler results ............................

Completed SQL validation in 2 minutes and 13 seconds.


Encountered unexpected TypeError: "Query has no runtime"
Full error traceback logged to file.

and these are the contents of the log file

2022-11-21 11:30:42,843 INFO | Completed SQL validation in 2 minutes and 13 seconds.

2022-11-21 11:30:42,850 DEBUG | Query has no runtime
Traceback (most recent call last):
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/cli.py", line 155, in wrapper
    return function(*args, **kwargs)
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/cli.py", line 276, in main
    asyncio.run(
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/utils.py", line 60, in timed_function
    result = await fn(*args, **kwargs)
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/cli.py", line 938, in run_sql
    results = await runner.validate_sql(
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/runner.py", line 400, in validate_sql
    await validator.search(
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/validators/sql.py", line 231, in search
    print_profile_results(self._long_running_queries, self.runtime_threshold)
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/validators/sql.py", line 79, in print_profile_results
    [query.to_profiler_format() for query in queries_by_runtime],
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/validators/sql.py", line 79, in <listcomp>
    [query.to_profiler_format() for query in queries_by_runtime],
  File "/Users/bruno/Work/spectacles/.venv/lib/python3.10/site-packages/spectacles/validators/sql.py", line 55, in to_profiler_format
    raise TypeError("Query has no runtime")
TypeError: Query has no runtime
2022-11-21 11:30:42,855 ERROR |
Encountered unexpected TypeError: "Query has no runtime"
Full error traceback logged to file.

For support, please create an issue at https://github.com/spectacles-ci/spectacles/issues

I've tried using different Python version (3.8, 3.9 and 3.10) and the result was always the same.

Everything seems to work fine if I run the SQL Validation without the --profile flag.

@joshtemple
Copy link
Collaborator

Hey @brunocostalopes, this looks like a bug with our latest release. We'll investigate and get a fix out later today or tomorrow. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants