Skip to content

Conversation

@synodriver
Copy link
Owner

No description provided.

elben10 and others added 30 commits August 25, 2021 17:21
Rather than integer based serialization grandfathered in from sqlalchemy, use the stdlib [`UUID.hex`](https://docs.python.org/3/library/uuid.html#uuid.UUID.hex) method.

This also fixes fastapi#25
Allow Field function to accept kwargs. Extra key word arguments get passed to the FieldInfo.extra dictionary. This mirrors Pydantic behavior.
fix SQLModel.parse_obj, SQLModel.validate method return type
"SQLModel" -> _TSQLModel

[issues link](fastapi#317)
fix: SQLAlchemy version 1.4.36 breaks SQLModel relationships
fix: update Select and SelectOfScalar to inherit cache
leynier added 27 commits June 8, 2022 16:08
perf: raise exception if no matching sqlalchemy type
feat: allow field to accept kwargs
feat: add foreign_key name to wrapper
…-kwarg

feat: addition of optional validate
feat: supporting pydantic custom root models as columns
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 24, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.53%.

Quality metrics Before After Change
Complexity 10.98 🙂 11.67 🙂 0.69 👎
Method Length 62.51 🙂 61.02 ⭐ -1.49 👍
Working memory 9.00 🙂 9.32 🙂 0.32 👎
Quality 61.45% 🙂 59.92% 🙂 -1.53% 👎
Other metrics Before After Change
Lines 975 1111 136
Changed files Quality Before Quality After Quality Change
sqlmodel/init.py 71.72% 🙂 71.63% 🙂 -0.09% 👎
sqlmodel/main.py 56.87% 🙂 55.33% 🙂 -1.54% 👎
sqlmodel/ext/asyncio/session.py 76.99% ⭐ 80.15% ⭐ 3.16% 👍
sqlmodel/orm/session.py 81.49% ⭐ 81.49% ⭐ 0.00%
sqlmodel/sql/sqltypes.py 83.15% ⭐ 86.17% ⭐ 3.02% 👍
tests/test_tutorial/test_create_db_and_table/test_tutorial001.py 88.40% ⭐ 88.40% ⭐ 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
sqlmodel/main.py SQLModelMetaclass.__init__ 33 ⛔ 224 ⛔ 16 ⛔ 22.51% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
sqlmodel/main.py SQLModelMetaclass.__new__ 20 😞 294 ⛔ 14 😞 28.90% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
sqlmodel/main.py get_column_from_field 15 🙂 233 ⛔ 12 😞 38.51% 😞 Try splitting into smaller methods. Extract out complex expressions
sqlmodel/main.py Field 1 ⭐ 132 😞 33 ⛔ 48.07% 😞 Try splitting into smaller methods. Extract out complex expressions
sqlmodel/main.py create_model 12 🙂 112 🙂 13 😞 50.69% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@synodriver synodriver merged commit e7b7850 into synodriver:main Jun 24, 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.