Handling table path as character #359
Closed
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.
Case:
Less experienced users may use the above code to write the table to
"private"
schema.This will in fact write table named
private.schema.iris
to"public"
schema, which may result with accidental leak of data. It also simplify usability for this group of users.Issue:
dbQuoteIdentifier
is not handling full table identifier as character .Example:
Execution of
dbWriteTable(con, "private_schema.iris", iris)
will save the table to"current_schema"."private_schema.iris"
.This PR is a proposition to add an option to unquote the identifier while calling
dbQuoteIdentifier
.It simply allows read/write methods from/to
"private_schema"."iris"
.Description:
unquote_id
the parameter that can enable the feature (specified while setting up the connection) - setting toTRUE
converts character to the identifier before being quoted.Because
dbQuoteIdentifier
doesn't store the information about type of the data (schema, table, fields) I've had to detect it with the usage ofmatch.call
:!grepl("names\\((.*?)\\)", as.character(match.call())[[3]])
.This allows to handle cases where table fields contain
.
character in names.