Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Restrict table alias length to avoid truncation #1097
Restrict table alias length to avoid truncation #1097
Changes from 17 commits
d672e9c
c44fa25
0a6c130
1dae6fb
d949e2d
3b1ff56
320fdb5
64c39af
c080d79
abad91d
059b4c9
69375ff
de2c0c0
ebb5c71
712ae8d
c3bcbcb
fa72746
2cc909e
d98db49
6cf5580
5d64882
51f81c3
65589ea
b0d0ecf
431d05b
3cd5d2f
9c20fde
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this comment is saying. Can you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is seemingly a fundamental limitation to
abbreviate()
which does not allow for both (a) max length to be binding and (b) names to be guaranteed unique.From the documentation:
I've opted for
strict = FALSE
to preserve uniqueness (sincedbplyr
will assert as much downstream, anyway), but there remains a non-zero risk that aliases still exceed the database limit. As one mitigation, I've updated themethod
toboth.sides
which tends to add a bit more scrambling (slightly less obvious alias names) but the resultant length is more likely to be aligned with the requested length.I've spent a decent amount of time playing with combinations of args (including discussing with ChatGPT) but couldn't come up with a fully-error proof solution using
abbreviate
or an alternate function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That table name is 68 characters long?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After using
method = "both.sides"
inabbreviate()
, this case is no longer an issue. This is a good example wheremethod = "left.keep"
preserves too much of the LHS at the expense of having unnecessary length.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that you want to make specific assertions about the length of the generate table names, is it possible to avoid the snapshot tests in favour of something more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thinking! Added some to look at the actual values from
generate_join_table_names()
; this catches the error observed above.