Skip to content

Import all 3rd party modules with an extra _module prefix #332

Closed
dominusmi wants to merge 1 commit intoagronholm:masterfrom
dominusmi:fixes-#331
Closed

Import all 3rd party modules with an extra _module prefix #332
dominusmi wants to merge 1 commit intoagronholm:masterfrom
dominusmi:fixes-#331

Conversation

@dominusmi
Copy link
Copy Markdown

This solves an issue which specifically affects the uuid classes (as explained here #331), but can generally affect any conflict in field name vs import.
What this PR do is add the prefix _module to any third-party imports, so for the case of uuid, it would result in a schema like:

import uuid as uuid_module
[...]
class SomeTable(Base):
  uuid: Mapped[uuid_module.uuid] = mapped_column(Uuid)

The third-party modules are used in two locations as can be seen in the compare. A better way to solve this would be to have some mapping instead a set, such as:

{"real module name": "imported as module name"}

but it would require bigger changes - this method works and is simple

@sheinbergon
Copy link
Copy Markdown
Collaborator

Already Fixed in master

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants