Navigation Menu

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

Support timed belief db mixin #53

Merged
merged 15 commits into from Apr 2, 2021
Merged

Support timed belief db mixin #53

merged 15 commits into from Apr 2, 2021

Conversation

Flix6x
Copy link
Collaborator

@Flix6x Flix6x commented Mar 29, 2021

Several improvements to the TimedBeliefDBMixin, including:

  • New method to persist TimedBelief objects from a BeliefsDataFrame
  • Set default table indices
  • Set default cumulative probability
  • Rename query method to prevent clashing with SQLAlchemy

@Flix6x Flix6x added the Database support Dealing with databases label Mar 29, 2021
@Flix6x Flix6x requested a review from nhoening March 29, 2021 21:35
@Flix6x Flix6x self-assigned this Mar 29, 2021
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Good stuff!
I have only smallish comments, only two I really think need to be done.

timely_beliefs/beliefs/classes.py Outdated Show resolved Hide resolved
timely_beliefs/beliefs/classes.py Outdated Show resolved Hide resolved
timely_beliefs/beliefs/classes.py Show resolved Hide resolved
timely_beliefs/beliefs/classes.py Outdated Show resolved Hide resolved
timely_beliefs/beliefs/classes.py Outdated Show resolved Hide resolved
@@ -136,3 +136,6 @@ def test_custom_source_and_beliefs_with_mixin(db):

assert "my_belief_source" in db.tables.keys()
assert "my_timed_belief" in db.tables.keys()

bdf = JoyfulBeliefInCustomTable.query(session, sensor)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be query_all? If so, why does this assertion work? Is bdf maybe an sqlachemy.Query object instead of a BeliefsDataFrame?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used query on purpose, to have a test that triggers the corresponding FutureWarning. I've been following this strategy for all deprecations, for two reasons:

  1. The test suite will show FutureWarnings for upcoming deprecations, which keeps reminding developers to actually deprecate at some point.
  2. The developer that implements the actual deprecation will break the test, and is therefore made aware of the fact that dependent code may break (and hopefully, reflect on whether enough time has passed since the deprecation was announced).

I'm glad you noticed this, because giving it some more thought I can come up with a few things to improve this strategy:

  • Add a todo to the assert statement to amend the upcoming deprecation.
  • Note the version at which the deprecation was announced.

@Flix6x Flix6x requested a review from nhoening April 1, 2021 14:47
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Almost there! One comment/question I have is about the source parameter in search_session. Don't we still need a source_cls parameter?

Alternatively, pass sources as objects. Your code (lines 347f) seems to already assume they are.

@Flix6x
Copy link
Collaborator Author

Flix6x commented Apr 2, 2021

Does my last commit resolve you last question?

@Flix6x Flix6x requested a review from nhoening April 2, 2021 15:32
@Flix6x Flix6x merged commit 80a3e1f into master Apr 2, 2021
@Flix6x Flix6x deleted the support-TimedBeliefDBMixin branch April 2, 2021 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Database support Dealing with databases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants