Skip to content

Commit

Permalink
reset to default
Browse files Browse the repository at this point in the history
  • Loading branch information
bryannho committed Jan 26, 2024
1 parent 55fb956 commit e8034bc
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/sql/connection/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,6 @@ def _connection_execute(self, query, parameters=None):

def _execute_with_parameters(self, query, parameters):
"""Execute the query with the given parameters"""
if not parameters:
return self._connection.exec_driver_sql(query)

if IS_SQLALCHEMY_ONE:
out = self._connection.execute(sqlalchemy.text(query), **parameters)
Expand All @@ -770,7 +768,7 @@ def _execute_with_parameters(self, query, parameters):

return out

def raw_execute(self, query, parameters=None, with_=None):
def raw_execute(self, query, parameters=None, with_=None): # Reset to default
"""Run the query without any preprocessing
Parameters
Expand All @@ -793,20 +791,19 @@ def raw_execute(self, query, parameters=None, with_=None):
if with_:
query = self._resolve_cte(query, with_)

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,
)
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:
required_parameters = set(sqlalchemy.text(query).compile().params)
Expand Down

0 comments on commit e8034bc

Please sign in to comment.