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

✨ Add official UUID support, docs and tests, internally using new SQLAlchemy 2.0 types #992

Merged
merged 13 commits into from
Jul 17, 2024

Conversation

estebanx64
Copy link
Contributor

No description provided.

Copy link

📝 Docs preview for commit d4d482d at: https://cbae96de.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit 184baf3 at: https://d4d7be97.sqlmodel.pages.dev

@alejsdev alejsdev added the feature New feature or request label Jul 5, 2024
tiangolo and others added 6 commits July 16, 2024 20:22
Keep consistency with other examples, functions without parameters, and printing info that shows and explains the UUID results (and can also be tested later)
* Explain the concepts at the beggining before using them.
* Explain how UUIDs can be used and trusted.
* Explain why UUIDs could be generated on the code, and how they can be used for distributed systems.
* Explain how UUIDs can prevent information leakage.
* Warn about UUIDs storage size.
* Explain that uuid is part of the standard library.
* Explain how default_factory works.
* Explain that creating an instance would generate a new UUID, before it is sent to the DB. This is included and shown in the example, the UUID is printed before saving to the DB.
* Remove sections about other operations that would behave the same as other fields and don't need additional info from what was explained in previous chapters.
* Add two examples to select using UUIDs, similar to the previous ones, mainly to be able to use them in the tests and ensure that it all works, even when SQLite stores the values as strings but the where() or the session.get() receive UUID values (ensure SQLAlchemy does the conversion correctly for SQLite).
* Add an example terminal run of the code, with comments.
* Simplify the ending to keep only the information that wasn't there before, just the "Learn More" with links.
@tiangolo tiangolo changed the title ✨ Add UUID support from sqlalchemy 2.0 update ✨ Add official UUID support, docs and tests, internally using new SQLAlchemy 2.0 types Jul 17, 2024
Copy link

📝 Docs preview for commit 6da6465 at: https://65189b1d.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit ad70ba0 at: https://a5413504.sqlmodel.pages.dev

@tiangolo
Copy link
Member

Thank you! 🚀

I updated the docs, examples, and tests a bit for consistency, to explain things a bit more, and to test that UUIDs are behaving as expected. 🤓

Now this is ready. 🎉

This will be available in SQLModel 0.0.20 in the next hours. 🚀

@tiangolo tiangolo merged commit 95936bb into main Jul 17, 2024
21 checks passed
@tiangolo tiangolo deleted the FL-399-uuid-support branch July 17, 2024 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants