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

UUID for postgreSQL #331

Open
1 task done
chris-han opened this issue Jun 6, 2024 · 4 comments
Open
1 task done

UUID for postgreSQL #331

chris-han opened this issue Jun 6, 2024 · 4 comments

Comments

@chris-han
Copy link

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

3.0.0RC5 generated model for pgsql using generic uuid type uuid.UUID, which need to be manually converted to the UUID type from sqlalchemy.dialects.postgresql:
from sqlalchemy.dialects.postgresql import UUID

from:
uuid: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True)
to:
uuid: Mapped[UUID] = mapped_column(Uuid, primary_key=True)

Use case

You'll need this every time you generate the models from pgsql which contains uuid type.

dominusmi added a commit to dominusmi/sqlacodegen that referenced this issue Jun 6, 2024
@dominusmi
Copy link

Pushed a possible fix. A bit hacky but give it a look. Tested locally on my database and works, wanted to run the repo tests and potentially add a test for this case, but they seem to be failing on master

sheinbergon pushed a commit to dominusmi/sqlacodegen that referenced this issue Jan 23, 2025
@sheinbergon sheinbergon added this to the 3.0 milestone Jan 23, 2025
@sheinbergon
Copy link
Collaborator

@dominusmi repo tests are now passing as expected. Tests are failing due to bad imports.
@agronholm generally speaking, what do you thing about #332? Doesn't sound like a bad idea to me?

@agronholm
Copy link
Owner

The import naming scheme in this project was supposed to rename conflicting imports by adding underscores (can't remember if by prepending or appending). The example in the description doesn't match the linked PR btw.

@agronholm
Copy link
Owner

Anyway, the real fix would be figuring out why the import renaming mechanism isn't working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants