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

Log failing SQL to file #179

Merged
merged 11 commits into from
Apr 15, 2020
Merged

Log failing SQL to file #179

merged 11 commits into from
Apr 15, 2020

Conversation

DylanBaker
Copy link
Collaborator

closes #84

This PR grabs the sql variable on the SqlError and logs the query to the logs and to a file in the logs directory.

Initially, I wrote it that the log_failing_sql function didn't take a directory, and just used the LOG_DIRECTORY global variable. I was having some difficulty getting the tests to work though as I couldn't seem to overwrite that variable and log the queries to a temp directory. Very open to feedback/advise on how to improve that.

@DylanBaker DylanBaker requested a review from joshtemple as a code owner April 4, 2020 16:04
tests/test_cli.py Show resolved Hide resolved
tests/test_cli.py Outdated Show resolved Hide resolved
spectacles/cli.py Show resolved Hide resolved
spectacles/cli.py Outdated Show resolved Hide resolved
spectacles/cli.py Outdated Show resolved Hide resolved
spectacles/cli.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 15, 2020

Codecov Report

Merging #179 into master will decrease coverage by 0.04%.
The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #179      +/-   ##
==========================================
- Coverage   70.70%   70.66%   -0.05%     
==========================================
  Files          10       10              
  Lines         809      818       +9     
==========================================
+ Hits          572      578       +6     
- Misses        237      240       +3     
Impacted Files Coverage Δ
spectacles/logger.py 57.69% <42.85%> (-22.31%) ⬇️
spectacles/cli.py 72.66% <80.00%> (+3.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc28a0e...8d458aa. Read the comment docs.

blahblah/queries/jaffle_shop__fct_orders.sql Outdated Show resolved Hide resolved
@DylanBaker DylanBaker merged commit c6692f2 into master Apr 15, 2020
@DylanBaker DylanBaker deleted the feature/failing-sql branch April 15, 2020 22:34
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 this pull request may close these issues.

Failing SQL is not saved to file
2 participants