-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Better error message for new new data sources #35679
Conversation
1347bfd
to
669a35b
Compare
'data': [list(row) for row in q[:20]], | ||
'total_rows': q.count(), | ||
'data': data, | ||
'total_rows': q.count() if data else 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will q.count
not show 0 if the table does not exist, or does it fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails if table is missing hence the catch to return 0 instead.
messages.error( | ||
self.request, | ||
_('Data source table not found!' | ||
'<br/>If you have recently added the data source, please wait for it to be created.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the error also occurs when a user updates the data source like adds a new column.
maybe update the message to reflect that as well ? Something like below
If you have recently added or modified the data source, please wait for operation to be completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ajeety4
Let me try that.
My understanding is that if the table is modified, it will only be deleted later by pillows, and so will be present during preview.
In case there is an error caused due to the change causing an error in the sql query, then it will be caught by the catch all error I mentioned in the description.
I will try and confirm this.
Let me know your follow up thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have good understanding of role of pillows in datasource creation or modification especially in what situation is triggered.
One of the situation that preview shows the above error is when user modifies the data source, rebuilds the data source and previews it before completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ajeety4
I confirmed that things are okay as of now. Here are the findings.
In case of a saving a new data source
- preview is unavailable
- user is told that table will be built/rebuilt by HQ
- accessing preview link directly shows the new error message
- once the table is created by pillows, preview is available and everything works fine
In case of an edit
- preview button is still available since table is present
- in case there is an error when generating the preview, due to nature of the change made, the user is shown the catch all generic message which seems good enough.
- once the table is recreated by pillows, things work fine from there on
In case the table is rebuilt
- before the table was even created, the preview button is unavailable
- the preview page shows the new message
- after the table was created, the preview continues to be available and once the table is rebuilt by pillows, fresh data starts to show up
It was good for me too to be more confident of these cases.
It seems you were thinking of the case when someone clicks on rebuild when the table does not even exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta say, I don't love showing psycopg2 exceptions to users. 😑 But okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mkangia for checking on this. Looks great to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta say, I don't love showing psycopg2 exceptions to users. 😑 But okay.
Ya, its not great.
It's an additional info for the user here. The relevant message is present above.
I might consider showing this sql exception to devs only, lets see, but in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
+1 Ajeet's suggested wording.
af91e3a
to
7b26cbc
Compare
Hey @kaapstorm @ajeety4 @Charl1996 |
<span | ||
class="hq-help-template" | ||
data-title="{% trans_html_attr 'Preview Unavailable' %}" | ||
data-content="{% trans_html_attr 'Preview unavailable till the data source table has been created.' %}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a fun read: https://www.merriam-webster.com/grammar/should-you-use-until-or-till-or-til
TLDR:
So there you have it: you will probably wish to avoid ’till, use ’til advisedly, and use both until and till freely. And if you use till in writing and someone tells you that you have made an error, simply take the extra L off the end of the word and poke them in the eye with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, I admit I wasn't sure how to phrase this and did doubt.
So, I believe this should be?
Preview unavailable until the data source table has been created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
946677f
Now I can be at peace, this was troubling me.
messages.error( | ||
self.request, | ||
_('Data source table not found!' | ||
'<br/>If you have recently added the data source, please wait for it to be created.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta say, I don't love showing psycopg2 exceptions to users. 😑 But okay.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
To resolve the sentry errors |
Product Description
Show user a better message to the user when previewing a data source if its missing or yet to be created.
Additionally, disable the preview button itself
Before:
![image](https://private-user-images.githubusercontent.com/3864163/406653083-efb3bf2b-6ba8-49a5-ae1b-906ea62e8a9c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzM2NjAsIm5iZiI6MTczOTU3MzM2MCwicGF0aCI6Ii8zODY0MTYzLzQwNjY1MzA4My1lZmIzYmYyYi02YmE4LTQ5YTUtYWUxYi05MDZlYTYyZThhOWMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMjI0OTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGJjMjE0MGRmNWU1YzdiN2Y2YWNmMmVhNTM0ZTAwN2IzYzgyY2JlNmE1ZDA4Y2Y4ZjBmMGEyMTAwOTE4NGNjMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.cV-qb-hSUBtXLkr-YsPi7nkdFCM9E73ATjxCIvCr48E)
After:
![image](https://private-user-images.githubusercontent.com/3864163/406652718-d9e9cb39-1046-4cab-9663-838e73fb4e94.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzM2NjAsIm5iZiI6MTczOTU3MzM2MCwicGF0aCI6Ii8zODY0MTYzLzQwNjY1MjcxOC1kOWU5Y2IzOS0xMDQ2LTRjYWItOTY2My04MzhlNzNmYjRlOTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMjI0OTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NzcyN2U4YTQyM2ViYmFiODMyNDU0OWQwOGExNGM4YThjOGMyYThlZDgxNzQxMDEzOTMyYzViOTIwMmM0ZTk4YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.-IJsWMXowU4xXK52GnYC7fNjnt2tb0RioTcQ36_D6pQ)
On Creating a new data source:
![Screenshot from 2025-01-28 13-26-46](https://private-user-images.githubusercontent.com/3864163/407238251-7fd31ed9-ce34-4ded-b7f7-c7c57314668c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzM2NjAsIm5iZiI6MTczOTU3MzM2MCwicGF0aCI6Ii8zODY0MTYzLzQwNzIzODI1MS03ZmQzMWVkOS1jZTM0LTRkZWQtYjdmNy1jN2M1NzMxNDY2OGMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMjI0OTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjQ1ZmRjYjdlN2I2NzhjYTdlN2VhNGIyMWU5ZDkwMWY5ZDRkYzQ4MjI2ZTgwY2NmMTEyYWEwOTAwMjBmOWQxMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.xBqJQZaAvItCOWpt2uONDreEAzN7xRWhUC0A00yEV8k)
Tooltip revealed on clicking the preview button (till replaced with until):
![image](https://private-user-images.githubusercontent.com/3864163/407239327-1f879629-9adf-4f35-bf69-ba105ccc5486.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzM2NjAsIm5iZiI6MTczOTU3MzM2MCwicGF0aCI6Ii8zODY0MTYzLzQwNzIzOTMyNy0xZjg3OTYyOS05YWRmLTRmMzUtYmY2OS1iYTEwNWNjYzU0ODYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMjI0OTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWIxNmZjOWQ1Y2Q5OGQ0MjQzNjVhZjRkNDhjZGFkNDYxNzYxNTZjZTA5YmViZWFjM2EzODNmZDI2YTNjZTg0MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.oENyKveKbpGwTailRC1-yZyuzl8sy2ovtsaXzfd54CI)
Technical Summary
https://dimagi.atlassian.net/browse/SC-4091
We do have a catch all for programming errors, from where we get the current message we show to the user.
Instead of modifying that to tell a user to wait for new data source to be created, chose to add a message specifically if the table is missing for a better user experience.
Since preview is a rare operation, checking for the table to be present should not add considerable load to the environment.
We can only consider creating the table if its missing when a data source is created. Currently the responsibility of creating new data sources is with pillows when they bootstrap every 4 hours.
Feature Flag
USER_CONFIGURABLE_REPORTS
Safety Assurance
Safety story
Tested locally that message shows well on the preview view which is the only one that is impacted.
For cases where table exists, things work well as before.
Automated test coverage
QA Plan
Not needed.
Rollback instructions
Labels & Review