Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
fail-fast: false
matrix:
python-version: [
2.7,
3.5,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python 3.5 was reached end-of-life last year.

Copy link
Member

Choose a reason for hiding this comment

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

Let's make a separate PR to remove 3.5 and merge it faster. I see no reason not to.

Copy link
Contributor Author

@yuokada yuokada Jan 15, 2021

Choose a reason for hiding this comment

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

Ok, reverted and send the pr to remove python3.5.
#71

3.6,
3.7,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Introduction

This package provides a client interface to query [Trino](https://trino.io/)
a distributed SQL engine. It supports Python 2.7, 3.5, 3.6, and pypy.
a distributed SQL engine. It supports Python>=3.5 and pypy.

# Installation

Expand Down
1 change: 0 additions & 1 deletion integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function

import os
import socket
Expand Down
1 change: 0 additions & 1 deletion integration_tests/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from datetime import datetime
import math

Expand Down
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

all_require = [kerberos_require]

tests_require = all_require + ["httpretty", "pytest", "pytest-runner", "mock", "pytz", "flake8"]

py27_require = ["ipaddress", "typing"]
tests_require = all_require + ["httpretty", "pytest", "pytest-runner", "pytz", "flake8"]

setup(
name="trino",
Expand All @@ -60,7 +58,6 @@
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
Expand All @@ -71,11 +68,11 @@
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Database :: Front-Ends",
],
install_requires=["click", "requests", "six"],
python_requires='>=3.5',
install_requires=["click", "requests"],
extras_require={
"all": all_require,
"kerberos": kerberos_require,
"tests": tests_require,
':python_version=="2.7"': py27_require,
},
)
9 changes: 1 addition & 8 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import httpretty
import pytest
import requests
import time
from unittest import mock

try:
from unittest import mock
except ImportError:
# python 2
import mock

from requests_kerberos.exceptions import KerberosExchangeError
from trino.client import TrinoQuery, TrinoRequest, TrinoResult
Expand Down
3 changes: 0 additions & 3 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
defined in pep-0249.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from trino import exceptions
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py35,py36,py37,py38,py39,pypy2
Copy link
Member

Choose a reason for hiding this comment

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

Are we losing test coverage for pypy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It would surely be good to do that in this PR itself if the tests are passing.

If CI fails on pypy3x let's create an issue for the follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like we aren't using tox in CI and instead directly run pytest https://github.com/trinodb/trino-python-client/blob/master/.github/workflows/ci.yml#L31.

Let's do this in a follow-up since this looks pre-existing anyway.

cc: @joshthoward

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... reverted.

envlist = py35,py36,py37,py38,py39

[testenv]
extras = tests
Expand Down
3 changes: 0 additions & 3 deletions trino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from . import auth
from . import dbapi
Expand Down
6 changes: 1 addition & 5 deletions trino/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import abc
import os

from six import with_metaclass
from typing import Any, Optional, Text # NOQA


class Authentication(with_metaclass(abc.ABCMeta)): # type: ignore
class Authentication(metaclass=abc.ABCMeta): # type: ignore
@abc.abstractmethod
def set_http_session(self, http_session):
pass
Expand Down
3 changes: 1 addition & 2 deletions trino/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
>> query = TrinoQuery(request, sql)
>> rows = list(query.execute())
"""
from __future__ import absolute_import, division, print_function

import copy
import os
Expand Down Expand Up @@ -517,7 +516,7 @@ def execute(self, additional_http_headers=None):
response = self._request.post(self._sql, additional_http_headers)
status = self._request.process(response)
self.query_id = status.id
self._stats.update({u"queryId": self.query_id})
self._stats.update({"queryId": self.query_id})
self._stats.update(status.stats)
self._warnings = getattr(status, "warnings", [])
if status.next_uri is None:
Expand Down
3 changes: 0 additions & 3 deletions trino/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, Optional, Text # NOQA: mypy types

Expand Down
5 changes: 1 addition & 4 deletions trino/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
Fetch methods returns rows as a list of lists on purpose to let the caller
decide to convert then to a list of tuples.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from typing import Any, List, Optional # NOQA for mypy types

Expand Down Expand Up @@ -329,7 +326,7 @@ def _format_prepared_param(self, param):
if isinstance(param, dict):
keys = list(param.keys())
values = [param[key] for key in keys]
return "MAP(%s, %s)" % (
return "MAP({}, {})".format(
Copy link
Member

Choose a reason for hiding this comment

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

Just as a note, when we drop support for 3.5 in the subsequent PR as discussed this could be replaced with an f-string instead.

self._format_prepared_param(keys),
self._format_prepared_param(values)
)
Expand Down
3 changes: 0 additions & 3 deletions trino/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
defined in pep-0249.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import functools
import random
Expand Down
3 changes: 0 additions & 3 deletions trino/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import logging

Expand Down
3 changes: 0 additions & 3 deletions trino/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from trino import constants
import trino.client
Expand Down