jdkandersson / OpenAlchemy

Define SQLAlchemy models using the OpenAPI specification.
https://openapi-sqlalchemy.readthedocs.io/en/latest/
Apache License 2.0
47 stars 13 forks source link

type:ignore in generated models not working #294

Closed madhamanchiharsha closed 3 years ago

madhamanchiharsha commented 3 years ago

Base = models.base # type: ignore AttributeError: module 'models' has no attribute 'base'

this is the error i see when i try to import that model in main.py any help...! (my whatsapp number is 7871234304 you can ping me here )

jdkandersson commented 3 years ago

Hi, I think if you change to Base = models.Base it should work, Please let me know how you go!

madhamanchiharsha commented 3 years ago

I have one question where can i give schema name like for example database.session.add(andersonObj) should do something like this INSERT INTO schema.anderson (id, name) VALUES (1, '2')

jdkandersson commented 3 years ago

Does this work for you? https://stackoverflow.com/questions/24542561/sqlalchemy-query-using-tables-in-two-mysql-schemas

If so, I would need to do an enhancement to the package, at the moment table args are not supported

madhamanchiharsha commented 3 years ago

Hi actually some times it is not working when my peer followed it was working fine for the code shown in open alchemy website those are examples. today morning i tried it is not working again.

On Tue, Mar 30, 2021 at 12:23 PM David Andersson @.***> wrote:

Does this work for you? https://stackoverflow.com/questions/24542561/sqlalchemy-query-using-tables-in-two-mysql-schemas

If so, I would need to do an enhancement to the package, at the moment table args are not supported

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jdkandersson/OpenAlchemy/issues/294#issuecomment-809962448, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRWTSOO55AL2AJ2RBE3AI3TGFYPNANCNFSM4ZZECA2A .

jdkandersson commented 3 years ago

I'm sorry to hear that, could you please share the code and any artefacts that show that it is not working (e.g., error messages)?

jdkandersson commented 3 years ago

I have added support for grouping models using schemas, as requested earlier in this issue. You can read the docs for it here: https://openapi-sqlalchemy.readthedocs.io/en/latest/technical_details/model.html#define-custom-schema-name

madhamanchiharsha commented 3 years ago

Thanks, I'll check it out.

On Sun, 4 Apr, 2021, 1:59 pm David Andersson, @.***> wrote:

I have added support for grouping models using schemas, as requested earlier in this issue. You can read the docs for it here: https://openapi-sqlalchemy.readthedocs.io/en/latest/technical_details/model.html#define-custom-schema-name

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jdkandersson/OpenAlchemy/issues/294#issuecomment-812995300, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRWTSIFHIU7ILYFWNFMOZLTHAIL5ANCNFSM4ZZECA2A .

jdkandersson commented 3 years ago

Closing for now, please reopen if this doesn't solve it for you.