-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Discrepancies in column types for social-auth-core derived database tables #19617
Comments
@nsoranzo thank you for pointing out the root cause! Removing I think the least invasive approach is to simply add type-ignores. Another approach would be to change this: Those columns should not be nullable, of course. However, there are numerous cases like those in the galaxy model, and all of them would require migrations. Which is why I suggest using type-ignore. |
The type annotation says how we use things in python, not how the database stores things and that it's nullable isn't of interest. deriving the column configuration from type annotations is certainly neat when it does match, but there's a reason this can be overridden. A prime example of how this makes no sense is galaxy/lib/galaxy/model/__init__.py Line 1464 in 2bf7c7e
I think foo = Mapped[str] = mapped_column(..., nullable=True) is the right approach, at least for the optionality case.
|
Apparently, it's not solvable with `nullable=True'
I'll look some more, but it may be an upstream problem. In which case I suggest going with the type-ignore, at least for now. |
although, apparently type-ignore won't solve that either.
|
@jdavcs Thanks for looking at this, the |
Also: - Improve annotation of `PartialMixin.data` - Remove unused `user` attribute of `UserMixin`, which may create type annotation conflicts in derived classes: galaxyproject/galaxy#19617
Also: - Improve annotation of `PartialMixin.data` - Remove unused `user` attribute of `UserMixin`, which may create type annotation conflicts in derived classes: galaxyproject/galaxy#19617
Also: - Improve annotation of `PartialMixin.data` - Remove unused `user` attribute of `UserMixin`, which may create type annotation conflicts in derived classes: galaxyproject/galaxy#19617
Those columns on both main and eu are empty. So a migration (TEXT to BLOB) would be painless. |
According to https://github.com/python-social-auth/social-core/blob/806de35d3756153cfadf64efbdd29c1ad6f425a6/social_core/storage.py#L295 , it should default to an empty dict, but this would already be a step in the right direction. |
Describe the bug
social-auth-core 4.5.5 has added initial type annotation, which is breaking our test_galaxy_packages tests (since these tests don't pin a version of the library).
The failing mypy tests are all about column types for database table inheriting from social-auth-core
*Mixin
classes. Some failures seem legitimate errors in our column type definitions, others may be discrepancies we can ignore with atype: ignore
, and some may be errors in type upstream type annotation:For reference, you can look at the reference definition of these tables from the social-auth-storage-sqlalchemy package: https://github.com/python-social-auth/social-storage-sqlalchemy/blob/master/social_sqlalchemy/storage.py
Initial assessment:
PSAAssociation(AssociationMixin)
:server_url
,handle
,secret
,issued
,lifetime
,assoc_type
: we could dropOptional
PSACode(CodeMixin)
:email
,code
: we could dropOptional
PSANonce(NonceMixin)
:server_url
,timestamp
,salt
: we could dropOptional
PSAPartial(PartialMixin)
:token
,backend
: we could dropOptional
data
: I think this should be changed fromMapped[Optional[str]] = mapped_column(TEXT)
toMapped[[Dict[str, Any]] = mapped_column(MutableJSONType)
next_step
: we could dropOptional
. Need to fix upstream type fromstr
toint
UserAuthnzToken(UserMixin)
:uid
,provider
: we could dropOptional
user
: drop theuser
attribute of theUserMixin
class upstream@jdavcs @dannon Thoughts?
The text was updated successfully, but these errors were encountered: