-
-
Notifications
You must be signed in to change notification settings - Fork 14
Add companies to database #338
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
base: main
Are you sure you want to change the base?
Conversation
# Add company to the database if it doesn't exist | ||
if company_name and company_email_domain: | ||
if not company_exists(company_name, company_email_domain): | ||
add_company(company_name, company_email_domain) |
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 line and the one above it constitute an n+1 query. approach aside, it should at minimum act on a batch of name+email rather than each one individually
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.
Agreed +1
from database import engine | ||
with Session(engine) as session: | ||
company = ( | ||
session.exec(select(Companies).where(Companies.company_name == company_name and |
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.
We might want to add a helper function. I am imagining scenarios where company name can vary based on the email - e.g. official application confirmation email says "Apero Health" but a later email about interview scheduling only refers to "Apero" but it's still referring to the same company so maybe we need a LIKE check (contains).
Though maybe we should be doing this similarity check beforehand, when processing the email... ok yeah that makes more sense. @jempio @elyseando
So never mind on this comment Kevin but will still leave this here as a TODO.
Pull Request
Description
Adds companies to the database when batch-inserting emails
Related Issue
Fixes #294 (without the company size features)
Type of Change
Changes Made
Screenshots
Testing
Steps to reproduce:
Checklist
Dependencies
Database Changes
[ ] Database changes included (describe below):
API Changes
[ ] API changes included (describe below):
Performance Impact
[ ] Performance impact (describe below):
Security Considerations
[ ] Security implications considered (describe below):
Additional Notes
Reviewer Notes
Post-Deployment Steps
[ ] Post-deployment steps required (describe below):
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.