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

Commit4b5e50c

Browse files
authored
Support trino type query (#129)
* Support Trino query type* Correct mock query call
1 parent3de0350 commit4b5e50c

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/.eggs
99
/.envrc
1010
/.tox
11+
/.venv
1112
/build
1213
/dist
1314
/tmp

‎tdclient/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def query(
248248
ValueError: if unknown query type has been specified
249249
"""
250250
# for compatibility, assume type is hive unless specifically specified
251-
iftypenotin ["hive","pig","impala","presto"]:
251+
iftypenotin ["hive","pig","impala","presto","trino"]:
252252
raiseValueError("The specified query type is not supported: %s"% (type))
253253
job_id=self.api.query(
254254
q,

‎tdclient/job_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def query(
390390
391391
Args:
392392
q (str): Query string.
393-
type (str): Query type. `hive`, `presto`, `bulkload`. Default: `hive`
393+
type (str): Query type. `hive`, `presto`, `trino`, `bulkload`. Default: `hive`
394394
db (str): Database name.
395395
result_url (str): Result output URL. e.g.,
396396
``postgresql://<username>:<password>@<hostname>:<port>/<database>/<table>``

‎tdclient/test/client_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,20 @@ def test_query():
197197
)
198198
assertjob.job_id=="12345"
199199

200+
deftest_trino_query():
201+
td=client.Client("APIKEY")
202+
td._api=mock.MagicMock()
203+
td._api.query=mock.MagicMock(return_value=("12345"))
204+
job=td.query("sample_datasets","SELECT 1",type="trino")
205+
td.api.query.assert_called_with(
206+
"SELECT 1",
207+
db="sample_datasets",
208+
type="trino",
209+
retry_limit=None,
210+
priority=None,
211+
result_url=None,
212+
)
213+
assertjob.job_id=="12345"
200214

201215
deftest_jobs():
202216
td=client.Client("APIKEY")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp