-
Notifications
You must be signed in to change notification settings - Fork 348
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
Fix bug in overwrite when using schema-qualified table names #102
Conversation
/cc @cfeduke |
if (s.startsWith("\"") && s.endsWith("\"")) s.drop(1).dropRight(1) else s | ||
def unescapeQuotes(s: String) = s.replace("\"\"", "\"") | ||
def unescape(s: String) = unescapeQuotes(dropOuterQuotes(s)) | ||
str.split('.').toSeq match { |
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.
Argh, it turns out that it's legal for .
to appear inside of delimited identifiers, so I'll have to do a quote-aware splitting here.
My experience in working with a wrapper for |
Current coverage is
|
LGTM |
This patch fixes #97, an issue where using
SaveMode.Overwrite
with schema-qualified table names (such asmy_schema.my_table
) would lead to "Invalid operation: syntax error at or near ".";" messages from Redshift.The problem is that the
ALTER TABLE ... RENAME
command only accepts unqualified table names as the new names, so we need to strip off the schema prior to performing the renaming.In order to keep this code clean, this patch introduces a new
TableName
case class which manages all of the escaping and parsing logic for table names, then uses that class to fix the Overwrite issue.