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

[WIP] sqlalchemy_utils for ColorType, JSONType, PasswordType, ScalarListType #217

Closed
wants to merge 23 commits into from

Conversation

colin99d
Copy link
Contributor

@colin99d colin99d commented Jun 26, 2022

This PR attempts to add the remaining sqlachemy_utils data types. Complete list here: https://sqlalchemy-utils.readthedocs.io/en/latest/data_types.html#module-sqlalchemy_utils.types.choice. Notes for each one appear below:

  • ArrowType: already implemented
  • ChoiceType: got this to work, but implementation is not super user friendly. Would love suggestions for a better implementation
  • CompositeType: postgres specific and I use mysql (:, skipping
  • ColorType: implemented
  • CountryType, CurrencyType, LocalType, WeekDaysType: currently breaks if nothing is sent to the form, this seems to be common among all forms using Babel. @aminalaee do you have any suggestion on how I could fix this?
  • : already implemented
  • EmailType: Did in Handling for sqlalchemy_utils EmailType and IPAddressType #150
  • EncryptedType: currently this uses a binary encryption which is not practical to type into a form. Based on their documentation this will be changed to a string implementation in the future and we can implement then.
  • JSONType: implemented
  • LtreeType: postgres specific and I use mysql (:, skipping
  • IPAddressType: Did in Handling for sqlalchemy_utils EmailType and IPAddressType #150
  • PasswordType: implemented
  • PhoneNumberType: This uses composite type, how do we want to implement it?
  • ScalarListType: implemented, however adding an item does not work well (I still think a bad implementation is better than the presence of the field crashing the server)
  • TimezoneType: implemented
  • TSVectorType: postgres specific and I use mysql (:, skipping
  • URLType: already implemented
  • UUIDType: already implemented

@aminalaee
Copy link
Owner

Any updates?

@colin99d
Copy link
Contributor Author

colin99d commented Jul 6, 2022

Yeah, was hoping for your thoughts on ChoiceType, CountryType, CurrencyType, LocalType and WeekDaysType. Then I was going to move on from there.

Copy link
Owner

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

scripts/install Outdated Show resolved Hide resolved
@converts("sqlalchemy_utils.types.choice.ChoiceType")
def conv_choice(
self, model: type, prop: ColumnProperty, kwargs: Dict[str, Any]
) -> UnboundField:
Copy link
Owner

Choose a reason for hiding this comment

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

@colin99d
Copy link
Contributor Author

colin99d commented Jul 8, 2022

Hey man, I did my best to implement choices like you suggested but ran into errors. Any way I could get some help?

@aminalaee
Copy link
Owner

@colin99d Thanks, I think the pipeline is failing for the black formatting, but if you see it's a blocker, just leave it outside the PR so we can pick it up later.

And also please rename the PR so it's clear what types are added.

@colin99d
Copy link
Contributor Author

So I should just exclude choices for now?

@colin99d colin99d changed the title [WIP] Adds the remaining sqlalchemy_utils data types [WIP] sqlalchemy_utils for ColorType, JSONType, PasswordType, ScalarListType Jul 11, 2022
@aminalaee
Copy link
Owner

Yes please.

@aminalaee
Copy link
Owner

Are you still interested in updating this?

@colin99d
Copy link
Contributor Author

Sorry kinda spaced it! Do you just need me to get CI to pass?

@aminalaee aminalaee closed this Aug 26, 2022
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.

None yet

2 participants