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

SQLAlchemy Prep: Surge on Query Updates #1538

Closed
5 tasks done
mjones-oddball opened this issue Nov 15, 2023 · 15 comments · Fixed by #1573
Closed
5 tasks done

SQLAlchemy Prep: Surge on Query Updates #1538

mjones-oddball opened this issue Nov 15, 2023 · 15 comments · Fixed by #1573

Comments

@mjones-oddball
Copy link

mjones-oddball commented Nov 15, 2023

User Story - Business Need

A pre-requisite to #1225 (SQLAlchemy Upgrade) is to update all the queries. We'd like a team surge on this as there will be many folders and files to update within the API codebase.

  • Ticket is understood, and QA has been contacted (if the ticket has a QA label).

User Story(ies)

As a platform
I want to keep my packages up to date
So that we avoid vulnerabilities and can use the latest functionality

Additional Info and Resources

Starter files to jump into:

Location Query count
app/celery/nightly_tasks.py 1
app/celery/scheduled_tasks.py 1
app/dao/init.py 1
app/dao/provider_rates_dao.py 1

Current workload:
Private Zenhub Image

1436 has cleared around 60 of those queries.

Engineering Checklist

  • Jump on a call and divvy up folders/files

Acceptance Criteria

  • regex search for \.query(\.|\() returns nothing
    • that would be things matching .query. or .query(
    • Skipped tests will have the queries removed
      - [ ] All select queries use read-only where appropriate Ended up being too much work just to convert everything. Read-only will be setup as-needed.

QA Considerations

@mjones-oddball
Copy link
Author

@k-macmillan
Copy link
Member

Team meeting times have been planned for Monday and Tuesday 1:30 to 3:30 Eastern.

@k-macmillan
Copy link
Member

We're all on the same page for updating:

  • How we will address the queries
  • How to see the new query is the same
  • How to test changes
  • Branch management

We are tracking progress with a document.

Most of the first few hours was just getting everyone setup and on the same page. Should be able to cruise now.

@kalbfled kalbfled linked a pull request Dec 19, 2023 that will close this issue
23 tasks
@k-macmillan
Copy link
Member

All queries have been updated. We are working through addressing unit test failures then we will deploy and run the regression.

@k-macmillan
Copy link
Member

Reviewed all PR comments and came to team consensus on each. Team is updating the PR based on the comments.

@k-macmillan
Copy link
Member

Friday and today we addressed the remaining comments.

  • All tests pass
  • Deployed
  • All regression tests pass

Will deploy to perf, regression test, then deploy to staging.

@k-macmillan
Copy link
Member

Perf deployed, passes regression. Staging deployed, passed regression. Going to let it sit.

@k-macmillan
Copy link
Member

Put this in QA testing for now. It is not merged. Giving it some time in staging to see if anything goes sideways.

@k-macmillan
Copy link
Member

Dug through all logs over the last 24 hours in staging.
The delete_notifications_older_than_retention_by_type method appears to have a warning.

/app/app/dao/notifications_dao.py:568: SAWarning: Coercing Subquery object into a 
select() for use in IN(); please pass a select() construct explicitly

The only other part to check are the stats query results. Would like to work with @cris-oddball, @EvanParish, and @mjones-oddball when they get back to validate the stats.

@mjones-oddball
Copy link
Author

In Staging I sent the following tests. Will check BQ tomorrow to confirm aggregation is correct in stats and billing. image.png

@k-macmillan
Copy link
Member

Another bug appears to exist between a Twilio notification being added to the DB and a lookup on that notification. Requires further investigation.

@mjones-oddball
Copy link
Author

Cris and I confirmed stats and billing data looked good

@k-macmillan
Copy link
Member

Updated with master (python 3.10/alpine upgrade).

Wrote a new method for the delivery status and wrote 44 tests (2 methods with 27 and 17 parameterizations) for the new method.

k-macmillan added a commit that referenced this issue Jan 5, 2024
Co-authored-by: EvanParish <[email protected]>
Co-authored-by: Kyle MacMillan <[email protected]>
Co-authored-by: Nikolai Efimov <[email protected]>
Co-authored-by: Kyle MacMillan <[email protected]>
@k-macmillan k-macmillan reopened this Jan 5, 2024
@cris-oddball
Copy link

PR approved and merged; master sent up to Perf. Just going to let it bake there over the weekend after running a regression.

@cris-oddball
Copy link

Regression passes, expected data in BQ, no errors seen in logs over the weekend. Given the testing this went through in staging, calling it good and closing ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants