Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Named parameters support#200

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletionssrc/databricks/sql/client.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@
CursorAlreadyClosedError,
)
from databricks.sql.thrift_backend import ThriftBackend
from databricks.sql.utils import ExecuteResponse, ParamEscaper, inject_parameters
from databricks.sql.utils import ExecuteResponse, ParamEscaper
from databricks.sql.types import Row
from databricks.sql.auth.auth import get_python_sql_connector_auth_provider
from databricks.sql.experimental.oauth_persistence import OAuthPersistence
Expand DownExpand Up@@ -482,21 +482,17 @@ def _handle_staging_remove(self, presigned_url: str, headers: dict = None):
)

def execute(
self, operation: str, parameters: Optional[Dict[str,str]] = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If we allowed users to do this I think we should continue to support it, but instead of injecting the parameter values in the driver we should convert to the format expected by the backend and pass it on.

self, operation: str, parameters: Optional[Dict[str,Any]] = None
) -> "Cursor":
"""
Execute a query and wait for execution to complete.
Parametersshould be given inextended paramformat style: %(...)<s|d|f>.
Named parametersshould be given inthisformat: :param.
For example:
operation = "SELECT * FROM table WHERE field =%(some_value)s"
parameters = {"some_value": "foo"}
Will result in the query"SELECT * FROM table WHERE field = 'foo' beingsent to the server
operation = "SELECT * FROM table WHERE field =:some_param"
parameters = {"some_param": "foo"}
Will result in the querywith the parameterssent to the server for server-side parameterization
:returns self
"""
if parameters is not None:
operation = inject_parameters(
operation, self.escaper.escape_args(parameters)
)

self._check_not_closed()
self._close_and_clear_active_result_set()
Expand All@@ -507,6 +503,7 @@ def execute(
max_bytes=self.buffer_size_bytes,
lz4_compression=self.connection.lz4_compression,
cursor=self,
parameters=parameters,
use_cloud_fetch=self.connection.use_cloud_fetch,
)
self.active_result_set = ResultSet(
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.17.0)
# Autogenerated by Thrift Compiler (0.18.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
Expand DownExpand Up@@ -45,7 +45,6 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print(' TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req)')
print(' TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)')
print(' TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)')
print(' TDBSqlGetLoadInformationResp GetLoadInformation(TDBSqlGetLoadInformationReq req)')
print('')
sys.exit(0)

Expand DownExpand Up@@ -251,12 +250,6 @@ elif cmd == 'RenewDelegationToken':
sys.exit(1)
pp.pprint(client.RenewDelegationToken(eval(args[0]),))

elif cmd == 'GetLoadInformation':
if len(args) != 1:
print('GetLoadInformation requires 1 args')
sys.exit(1)
pp.pprint(client.GetLoadInformation(eval(args[0]),))

else:
print('Unrecognized method %s' % cmd)
sys.exit(1)
Expand Down
191 changes: 1 addition & 190 deletionssrc/databricks/sql/thrift_api/TCLIService/TCLIService.py
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionsrc/databricks/sql/thrift_api/TCLIService/constants.py
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp