Skip to content

Commit

Permalink
remove escape when np disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bryannho committed Jan 23, 2024
1 parent 206bd0a commit 55fb956
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/sql/connection/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,19 +793,20 @@ def raw_execute(self, query, parameters=None, with_=None):
if with_:
query = self._resolve_cte(query, with_)

query, quoted_named_parameters = escape_string_literals_with_colon_prefix(query)

if quoted_named_parameters and parameters:
intersection = set(quoted_named_parameters) & set(parameters)

if intersection:
intersection_ = ", ".join(sorted(intersection))
warnings.warn(
f"The following variables are defined: {intersection_}. However "
"the parameters are quoted in the query, if you want to use "
"them as named parameters, remove the quotes.",
category=JupySQLQuotedNamedParametersWarning,
)
if parameters:
query, quoted_named_parameters = escape_string_literals_with_colon_prefix(query)

if quoted_named_parameters:
intersection = set(quoted_named_parameters) & set(parameters)

if intersection:
intersection_ = ", ".join(sorted(intersection))
warnings.warn(
f"The following variables are defined: {intersection_}. However "
"the parameters are quoted in the query, if you want to use "
"them as named parameters, remove the quotes.",
category=JupySQLQuotedNamedParametersWarning,
)

if parameters:
required_parameters = set(sqlalchemy.text(query).compile().params)
Expand Down

0 comments on commit 55fb956

Please sign in to comment.