diff --git a/.github/workflows/code-quality-checks.yml b/.github/workflows/code-quality-checks.yml index 03c3991d..2dd55b77 100644 --- a/.github/workflows/code-quality-checks.yml +++ b/.github/workflows/code-quality-checks.yml @@ -160,4 +160,7 @@ jobs: # mypy the code #---------------------------------------------- - name: Mypy - run: poetry run mypy --install-types --non-interactive src + run: | + cd src # Need to be in the actual databricks/ folder or mypy does the wrong thing. + mkdir .mypy_cache # Workaround for bad error message "error: --install-types failed (no mypy cache directory)"; see https://github.com/python/mypy/issues/10768#issuecomment-2178450153 + poetry run mypy --config-file ../pyproject.toml --install-types --non-interactive --namespace-packages databricks diff --git a/src/databricks/py.typed b/src/databricks/sql/py.typed similarity index 100% rename from src/databricks/py.typed rename to src/databricks/sql/py.typed diff --git a/src/databricks/sql/utils.py b/src/databricks/sql/utils.py index 9f21a8eb..6063eca1 100644 --- a/src/databricks/sql/utils.py +++ b/src/databricks/sql/utils.py @@ -7,7 +7,7 @@ from collections.abc import Iterable from decimal import Decimal from enum import Enum -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union import re import lz4.frame @@ -134,7 +134,7 @@ def __init__( schema_bytes, max_download_threads: int, start_row_offset: int = 0, - result_links: List[TSparkArrowResultLink] = None, + result_links: Optional[List[TSparkArrowResultLink]] = None, lz4_compressed: bool = True, description: List[List[Any]] = None, ): @@ -168,11 +168,10 @@ def __init__( result_link.startRowOffset, result_link.rowCount ) ) - self.download_manager = ResultFileDownloadManager( self.max_download_threads, self.lz4_compressed ) - self.download_manager.add_file_links(result_links) + self.download_manager.add_file_links(result_links or []) self.table = self._create_next_table() self.table_row_index = 0 diff --git a/src/databricks/sqlalchemy/py.typed b/src/databricks/sqlalchemy/py.typed new file mode 100755 index 00000000..e69de29b