Skip to content

Conversation

@gadenbuie
Copy link
Contributor

@gadenbuie gadenbuie commented Dec 8, 2025

Fixes #146

This PR updates the sql() reactive to be a string or NULL/None, making sql() consistent with title().

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.

return data_source.get_data()
else:
return data_source.execute_query(sql.get())
return data_source.execute_query(query)
Copy link
Contributor Author

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).

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@cpsievert cpsievert Dec 8, 2025

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 👍

@gadenbuie gadenbuie requested a review from cpsievert December 8, 2025 19:09
Copy link
Contributor

@cpsievert cpsievert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gadenbuie gadenbuie merged commit a0e5d33 into main Dec 9, 2025
15 of 16 checks passed
@gadenbuie gadenbuie deleted the fix/146-empty-sql-title branch December 9, 2025 22:03
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.

Revisit sql() returning "" and title() returning None when neither are set

3 participants