-
Notifications
You must be signed in to change notification settings - Fork 321
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
LTreeType and LTree with the new version of sqlalchemy #697
Comments
Library version 0.41.1, sqlalchemy 2.0.18 I did not try LTree but it is quite strange that it would not work since it is a primitive type and not a sqlalchemy type. Password and PhoneNumber seems to work. For the persons that are looking for a current syntax with sqlalchemy 2.0+: (If it can also help for the documentation) from phonenumbers import PhoneNumber
from sqlalchemy_utils import EmailType, PhoneNumberType, PasswordType, Password
class User(Base):
__tablename__ = 'user'
id: Mapped[int] = mapped_column(primary_key=True)
password: Mapped[Password] = mapped_column(PasswordType(schemes=['pbkdf2_sha512']))
email: Mapped[str] = mapped_column(EmailType)
phone: Mapped[PhoneNumber] = mapped_column(PhoneNumberType) However, EmailType only makes the email be a lower-case value which is a little bit disappointing. I might open a issue for this but it would be great to use email-validator as an extra, just like phonenumber. |
Any update on this? I got the same issue with SQLAlchem v2.0.19 and SQLAlchemy-Utils v0.41.1. If I specify the column as @BBArikL instructed: |
This was my bad. My local setup was still pointing to old version of SQLAlchemy. So I can confirm that this indeed works like this:
|
Library version 0.40.0, sqlalchemy 2.0.4
Created this model:
As a result of running the code I have these errors:
How to use LTreeType and LTree types correctly with the new version of sqlalchemy? It looks like the documentation hasn't been updated yet.
The text was updated successfully, but these errors were encountered: