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 support for Ormar orm #84

Closed
1 task done
sorasful opened this issue Mar 12, 2022 · 1 comment
Closed
1 task done

Add support for Ormar orm #84

sorasful opened this issue Mar 12, 2022 · 1 comment
Labels

Comments

@sorasful
Copy link

Checklist

  • There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

No response

Describe the solution you would like.

Hello !

First, thanks for this amazing package, this community really needs this.

I tried to use sqladmin with Ormar https://github.com/collerek/ormar/ which is basically another ORM built on top of SQLalchemy. And it seems that sqladmin has troubles with fields, even though under the hood it's SQLachemy, I think you have the same problem while implemtenting SQLModel.

So I figured out maybe if we implement for SQLmodel, we shouldn't be that far from being to implement another ORM.

Traceback (most recent call last):
  File "/.cache/pypoetry/virtualenvs/api-5UH-8tMH-py3.10/lib/python3.10/site-packages/sqladmin/models.py", line 57, in __new__
    mapper = inspect(model)
  File "ache/pypoetry/virtualenvs/-5UH-8tMH-py3.10/lib/python3.10/site-packages/sqlalchemy/inspection.py", line 71, in inspect
    raise exc.NoInspectionAvailable(
sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type <class 'ormar.models.metaclass.ModelMetaclass'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/pegazor_api/__main__.py", line 95, in <module>
    class UserAdmin(ModelAdmin, model=User):
  File "/pypoetry/virtualenvs/i-5UH-8tMH-py3.10/lib/python3.10/site-packages/sqladmin/models.py", line 59, in __new__
    raise InvalidModelError(
sqladmin.exceptions.InvalidModelError: Class User is not a SQLAlchemy model.

Thank you :)

Describe alternatives you considered

No response

Additional context

No response

@aminalaee
Copy link
Owner

Hey, thanks for the suggestion.

Well we can consider this in the future.
But the difference between SQLModel and ormar models is that SQLModel will be SQLALchemy models at the same time (at least to my understanding), so we don't have to do much to support them.
But let's keep this open for future references, maybe we could do it in a sane way 👍

@aminalaee aminalaee added the enhancement New feature or request label Mar 13, 2022
@aminalaee aminalaee added hold and removed enhancement New feature or request labels Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants