-
Notifications
You must be signed in to change notification settings - Fork 22
chore: sql() reactive returns NULL or None if not set
#149
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
Conversation
| return data_source.get_data() | ||
| else: | ||
| return data_source.execute_query(sql.get()) | ||
| return data_source.execute_query(query) |
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.
If we update .execute_query() to accept a None value, similar to "", we could avoid needing to store the result of sql.get() in an intermediate variable (to satisfy the type checker).
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.
Yea, seems like that'd be a good idea?
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.
Nah, that means we'd have to change the return value of execute_query() which currently is annotated as pd.Dataframe, which then has implications in the base and extender classes. That doesn't seem worth it 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.
Ah ok, the current approach seems fine 👍
cpsievert
left a comment
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!
Fixes #146
This PR updates the
sql()reactive to be a string orNULL/None, makingsql()consistent withtitle().The other way to have made these consistent would have been to set them to
""when unset. That would make checking for emptiness easier, but didn't feel quite right, so I went with the current approach. I largely expect the overall impact to be minimal.