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

Changed user-fi model to allow nullable/empty state field #210

Merged
merged 4 commits into from
Aug 21, 2024

Conversation

jcadam14
Copy link
Contributor

Closes #209

@jcadam14 jcadam14 self-assigned this Aug 12, 2024
@jcadam14 jcadam14 linked an issue Aug 12, 2024 that may be closed by this pull request
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/regtech_user_fi_management/entities/models
  dao.py
  dto.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Member

@hkeeler hkeeler left a comment

Choose a reason for hiding this comment

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

Looks good. In the long run, I'd be interested in coming up with some other solution for these edge cases where we don't have to allow null on state, but for now 👍.

Just the one question about the greenlet change package and whether it should be part of this PR or not.

pyproject.toml Outdated
@@ -15,6 +15,7 @@ asyncpg = "^0.29.0"
alembic = "^1.13.2"
regtech-api-commons = {git = "https://github.com/cfpb/regtech-api-commons.git"}
regtech-regex = {git = "https://github.com/cfpb/regtech-regex.git"}
greenlet = "^3.0.3"
Copy link
Member

Choose a reason for hiding this comment

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

Was this to fix the Mac chip issue? And was this coming in as a dependency of something else before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sorry for the delayed response. This was coming with SQLAlchemy but poetry seems to have an issue finding the M-series chips distros for greenlet, so the suggestions I found online was to simply explicitly define the dependency versus relying on poetry to install the dependency. Didn't come across this issue until the new Mac. And only is an issue when trying to run things within poetry.

One solution for images I found is adding --platform=linux/amd64 to the Dockerfile FROM statement so it forces a particular architecture in the image, alleviating potential issues between where the image is built and what it's run on (found that messing with lambdas). Wouldn't help the reason for this change, but thinking of adding stories to all our repos to make that a thing across the board. Thoughts?

Copy link
Member

@hkeeler hkeeler Aug 20, 2024

Choose a reason for hiding this comment

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

Interesting. At first I was surprised to see greenlet in there. I thought it was more of a pre-asyncio way of doing async in Python. Looking at Using events with the asyncio extension (you gotta scroll down to asyncio and events, two opposites), it looks like internally it handles async via greenlet, and then does a asyncio wrapper API that dev interact with. Makes sense. SQLAlchemy has been around way longer than asyncio, so that's probably a way to add support without changing the guts of SQLAlchemy. Anyway, I get why it's there now. 😄

Looking at I’m getting an error about greenlet not being installed when I try to use asyncio, it sounds like we can fix this by using the sqlalchemy[asyncio] package. If that works, might be better to go that route in case there are other asyncio-related bits added to that package.

And yeah, I've read about building containers images for different architectures, but I've never had to do it. So, you're ahead of me on that front. Probably worth a chat to sync up on that and what you've learned. As you say, don't have to solve that for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok found the way to do the equivalent in of sqlalchemy[asyncio] in pyproject.toml, versus explicitly pulling in greenlet.

@jcadam14 jcadam14 merged commit ea4e74e into main Aug 21, 2024
7 checks passed
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.

Handle non-US hq_address_state_code better.
2 participants