Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/.eggs
/.envrc
/.tox
/.venv
/build
/dist
/tmp
Expand Down
2 changes: 1 addition & 1 deletion tdclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def query(
ValueError: if unknown query type has been specified
"""
# for compatibility, assume type is hive unless specifically specified
if type not in ["hive", "pig", "impala", "presto"]:
if type not in ["hive", "pig", "impala", "presto", "trino"]:
raise ValueError("The specified query type is not supported: %s" % (type))
job_id = self.api.query(
q,
Expand Down
2 changes: 1 addition & 1 deletion tdclient/job_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def query(

Args:
q (str): Query string.
type (str): Query type. `hive`, `presto`, `bulkload`. Default: `hive`
type (str): Query type. `hive`, `presto`, `trino`, `bulkload`. Default: `hive`
db (str): Database name.
result_url (str): Result output URL. e.g.,
``postgresql://<username>:<password>@<hostname>:<port>/<database>/<table>``
Expand Down
14 changes: 14 additions & 0 deletions tdclient/test/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,20 @@ def test_query():
)
assert job.job_id == "12345"

def test_trino_query():
td = client.Client("APIKEY")
td._api = mock.MagicMock()
td._api.query = mock.MagicMock(return_value=("12345"))
job = td.query("sample_datasets", "SELECT 1", type="trino")
td.api.query.assert_called_with(
"SELECT 1",
db="sample_datasets",
type="trino",
retry_limit=None,
priority=None,
result_url=None,
)
assert job.job_id == "12345"

def test_jobs():
td = client.Client("APIKEY")
Expand Down