diff --git a/.changes/unreleased/Dependencies-20230628-121341.yaml b/.changes/unreleased/Dependencies-20230628-121341.yaml new file mode 100644 index 000000000..5569c885d --- /dev/null +++ b/.changes/unreleased/Dependencies-20230628-121341.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Replace sasl with pure-sasl for PyHive +time: 2023-06-28T12:13:41.141588-07:00 +custom: + Author: colin-rogers-dbt + PR: "818" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0dccff849..c24bc0d37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,7 +79,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] env: TOXENV: "unit" @@ -177,7 +177,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - name: Set up Python ${{ matrix.python-version }} diff --git a/dbt/adapters/spark/connections.py b/dbt/adapters/spark/connections.py index df0dcb5ee..9598cccf9 100644 --- a/dbt/adapters/spark/connections.py +++ b/dbt/adapters/spark/connections.py @@ -31,8 +31,8 @@ from thrift.transport.TSSLSocket import TSSLSocket import thrift import ssl - import sasl import thrift_sasl + from puresasl.client import SASLClient except ImportError: pass # done deliberately: setting modules to None explicitly violates MyPy contracts by degrading type semantics @@ -530,17 +530,15 @@ def build_ssl_transport(host, port, username, auth, kerberos_service_name, passw # to be nonempty. password = "x" - def sasl_factory(): - sasl_client = sasl.Client() - sasl_client.setAttr("host", host) + def sasl_factory() -> SASLClient: if sasl_auth == "GSSAPI": - sasl_client.setAttr("service", kerberos_service_name) + sasl_client = SASLClient(host, kerberos_service_name, mechanism=sasl_auth) elif sasl_auth == "PLAIN": - sasl_client.setAttr("username", username) - sasl_client.setAttr("password", password) + sasl_client = SASLClient( + host, mechanism=sasl_auth, username=username, password=password + ) else: raise AssertionError - sasl_client.init() return sasl_client transport = thrift_sasl.TSaslClientTransport(sasl_factory, sasl_auth, socket) diff --git a/dev-requirements.txt b/dev-requirements.txt index 9ea3075e0..35e1d44d9 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -33,5 +33,4 @@ wheel~=0.40 # Adapter specific dependencies mock~=5.0 -sasl~=0.3.1 thrift_sasl~=0.4.3 diff --git a/requirements.txt b/requirements.txt index ce359bec9..5795147eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -PyHive[hive]>=0.6.0,<0.7.0 -requests[python]>=2.28.1 +pyhive[hive_pure_sasl]~=0.7.0 +requests>=2.28.1 pyodbc==4.0.34 sqlparams>=3.0.0 diff --git a/setup.py b/setup.py index fc4ac7a82..26a96847c 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,6 @@ print("Please upgrade to Python 3.7 or higher.") sys.exit(1) - # require version of setuptools that supports find_namespace_packages from setuptools import setup @@ -54,9 +53,9 @@ def _get_dbt_core_version(): dbt_core_version = _get_dbt_core_version() description = """The Apache Spark adapter plugin for dbt""" -odbc_extras = ["pyodbc>=4.0.30"] +odbc_extras = ["pyodbc>=4.0.39"] pyhive_extras = [ - "PyHive[hive]>=0.6.0,<0.7.0", + "PyHive[hive_pure_sasl]~=0.7.0", "thrift>=0.11.0,<0.17.0", ] session_extras = ["pyspark>=3.0.0,<4.0.0"] @@ -94,6 +93,7 @@ def _get_dbt_core_version(): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ], python_requires=">=3.7", )