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

DM-21454: Include all column names in foreign key names. #195

Merged
merged 4 commits into from Oct 4, 2019

Conversation

TallJimbo
Copy link
Member

This is the easiest way to ensure unique foreign key names.

This is the easiest way to ensure unique foreign key names.
@@ -305,9 +305,10 @@ def toSqlAlchemy(self, tableName: str, schema: Schema) -> ForeignKeyConstraint:
constraint : `sqlalchemy.ForeignKeyConstraint`
SQLAlchemy version of the foreign key constraint.
"""
name = "_".join(["fkey", tableName, self.table] + list(self.target) + list(self.source))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has a potential to exceed name size limits for some backends.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about that, too, but @MichelleGower hasn't reported any problems in her tests yet, and I don't think we can guarantee a unique name without including all of these terms, even if they aren't usually necessary. Given that this isn't really a useful-visible name (except maybe in some pretty low-level debugging contexts), I think the next step is probably trying to hash these terms into something with fixed size, and I'd rather not do that on this ticket.

TallJimbo and others added 3 commits September 30, 2019 14:47
There is an abstract filter called "UNRECOGNISED" in table
PHYSICAL_FILTER which was longer than the column width.
Increased the column width from 8 to 16.
@MichelleGower
Copy link
Contributor

With these changes and a newer version of SQLAlchemy, I was able to run ci_hsc_gen3 with Oracle.

@TallJimbo TallJimbo merged commit 561929e into master Oct 4, 2019
@TallJimbo TallJimbo deleted the tickets/DM-21454 branch October 4, 2019 22:46
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.

None yet

3 participants