From 5864dfccc9d273dff3c8e9219513cea7e12baa91 Mon Sep 17 00:00:00 2001 From: Shivam Raj Date: Wed, 3 Jul 2024 10:34:02 +0530 Subject: [PATCH 1/3] moved tests to respective package directories --- conftest.py => pysql-connector/conftest.py | 0 {tests => pysql-connector/tests}/__init__.py | 0 {tests => pysql-connector/tests}/e2e/__init__.py | 0 {tests => pysql-connector/tests}/e2e/common/__init__.py | 0 {tests => pysql-connector/tests}/e2e/common/core_tests.py | 0 {tests => pysql-connector/tests}/e2e/common/decimal_tests.py | 0 .../tests}/e2e/common/large_queries_mixin.py | 0 {tests => pysql-connector/tests}/e2e/common/predicates.py | 0 {tests => pysql-connector/tests}/e2e/common/retry_test_mixins.py | 0 .../tests}/e2e/common/staging_ingestion_tests.py | 0 {tests => pysql-connector/tests}/e2e/common/timestamp_tests.py | 0 {tests => pysql-connector/tests}/e2e/common/uc_volume_tests.py | 0 {tests => pysql-connector/tests}/e2e/test_complex_types.py | 0 {tests => pysql-connector/tests}/e2e/test_driver.py | 0 .../tests}/e2e/test_parameterized_queries.py | 0 {tests => pysql-connector/tests}/unit/__init__.py | 0 {tests => pysql-connector/tests}/unit/test_arrow_queue.py | 0 {tests => pysql-connector/tests}/unit/test_auth.py | 0 {tests => pysql-connector/tests}/unit/test_client.py | 0 {tests => pysql-connector/tests}/unit/test_cloud_fetch_queue.py | 0 {tests => pysql-connector/tests}/unit/test_download_manager.py | 0 {tests => pysql-connector/tests}/unit/test_downloader.py | 0 {tests => pysql-connector/tests}/unit/test_endpoint.py | 0 {tests => pysql-connector/tests}/unit/test_fetches.py | 0 {tests => pysql-connector/tests}/unit/test_fetches_bench.py | 0 {tests => pysql-connector/tests}/unit/test_init_file.py | 0 {tests => pysql-connector/tests}/unit/test_oauth_persistence.py | 0 {tests => pysql-connector/tests}/unit/test_param_escaper.py | 0 {tests => pysql-connector/tests}/unit/test_parameters.py | 0 {tests => pysql-connector/tests}/unit/test_retry.py | 0 {tests => pysql-connector/tests}/unit/test_thrift_backend.py | 0 31 files changed, 0 insertions(+), 0 deletions(-) rename conftest.py => pysql-connector/conftest.py (100%) rename {tests => pysql-connector/tests}/__init__.py (100%) rename {tests => pysql-connector/tests}/e2e/__init__.py (100%) rename {tests => pysql-connector/tests}/e2e/common/__init__.py (100%) rename {tests => pysql-connector/tests}/e2e/common/core_tests.py (100%) rename {tests => pysql-connector/tests}/e2e/common/decimal_tests.py (100%) rename {tests => pysql-connector/tests}/e2e/common/large_queries_mixin.py (100%) rename {tests => pysql-connector/tests}/e2e/common/predicates.py (100%) rename {tests => pysql-connector/tests}/e2e/common/retry_test_mixins.py (100%) rename {tests => pysql-connector/tests}/e2e/common/staging_ingestion_tests.py (100%) rename {tests => pysql-connector/tests}/e2e/common/timestamp_tests.py (100%) rename {tests => pysql-connector/tests}/e2e/common/uc_volume_tests.py (100%) rename {tests => pysql-connector/tests}/e2e/test_complex_types.py (100%) rename {tests => pysql-connector/tests}/e2e/test_driver.py (100%) rename {tests => pysql-connector/tests}/e2e/test_parameterized_queries.py (100%) rename {tests => pysql-connector/tests}/unit/__init__.py (100%) rename {tests => pysql-connector/tests}/unit/test_arrow_queue.py (100%) rename {tests => pysql-connector/tests}/unit/test_auth.py (100%) rename {tests => pysql-connector/tests}/unit/test_client.py (100%) rename {tests => pysql-connector/tests}/unit/test_cloud_fetch_queue.py (100%) rename {tests => pysql-connector/tests}/unit/test_download_manager.py (100%) rename {tests => pysql-connector/tests}/unit/test_downloader.py (100%) rename {tests => pysql-connector/tests}/unit/test_endpoint.py (100%) rename {tests => pysql-connector/tests}/unit/test_fetches.py (100%) rename {tests => pysql-connector/tests}/unit/test_fetches_bench.py (100%) rename {tests => pysql-connector/tests}/unit/test_init_file.py (100%) rename {tests => pysql-connector/tests}/unit/test_oauth_persistence.py (100%) rename {tests => pysql-connector/tests}/unit/test_param_escaper.py (100%) rename {tests => pysql-connector/tests}/unit/test_parameters.py (100%) rename {tests => pysql-connector/tests}/unit/test_retry.py (100%) rename {tests => pysql-connector/tests}/unit/test_thrift_backend.py (100%) diff --git a/conftest.py b/pysql-connector/conftest.py similarity index 100% rename from conftest.py rename to pysql-connector/conftest.py diff --git a/tests/__init__.py b/pysql-connector/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to pysql-connector/tests/__init__.py diff --git a/tests/e2e/__init__.py b/pysql-connector/tests/e2e/__init__.py similarity index 100% rename from tests/e2e/__init__.py rename to pysql-connector/tests/e2e/__init__.py diff --git a/tests/e2e/common/__init__.py b/pysql-connector/tests/e2e/common/__init__.py similarity index 100% rename from tests/e2e/common/__init__.py rename to pysql-connector/tests/e2e/common/__init__.py diff --git a/tests/e2e/common/core_tests.py b/pysql-connector/tests/e2e/common/core_tests.py similarity index 100% rename from tests/e2e/common/core_tests.py rename to pysql-connector/tests/e2e/common/core_tests.py diff --git a/tests/e2e/common/decimal_tests.py b/pysql-connector/tests/e2e/common/decimal_tests.py similarity index 100% rename from tests/e2e/common/decimal_tests.py rename to pysql-connector/tests/e2e/common/decimal_tests.py diff --git a/tests/e2e/common/large_queries_mixin.py b/pysql-connector/tests/e2e/common/large_queries_mixin.py similarity index 100% rename from tests/e2e/common/large_queries_mixin.py rename to pysql-connector/tests/e2e/common/large_queries_mixin.py diff --git a/tests/e2e/common/predicates.py b/pysql-connector/tests/e2e/common/predicates.py similarity index 100% rename from tests/e2e/common/predicates.py rename to pysql-connector/tests/e2e/common/predicates.py diff --git a/tests/e2e/common/retry_test_mixins.py b/pysql-connector/tests/e2e/common/retry_test_mixins.py similarity index 100% rename from tests/e2e/common/retry_test_mixins.py rename to pysql-connector/tests/e2e/common/retry_test_mixins.py diff --git a/tests/e2e/common/staging_ingestion_tests.py b/pysql-connector/tests/e2e/common/staging_ingestion_tests.py similarity index 100% rename from tests/e2e/common/staging_ingestion_tests.py rename to pysql-connector/tests/e2e/common/staging_ingestion_tests.py diff --git a/tests/e2e/common/timestamp_tests.py b/pysql-connector/tests/e2e/common/timestamp_tests.py similarity index 100% rename from tests/e2e/common/timestamp_tests.py rename to pysql-connector/tests/e2e/common/timestamp_tests.py diff --git a/tests/e2e/common/uc_volume_tests.py b/pysql-connector/tests/e2e/common/uc_volume_tests.py similarity index 100% rename from tests/e2e/common/uc_volume_tests.py rename to pysql-connector/tests/e2e/common/uc_volume_tests.py diff --git a/tests/e2e/test_complex_types.py b/pysql-connector/tests/e2e/test_complex_types.py similarity index 100% rename from tests/e2e/test_complex_types.py rename to pysql-connector/tests/e2e/test_complex_types.py diff --git a/tests/e2e/test_driver.py b/pysql-connector/tests/e2e/test_driver.py similarity index 100% rename from tests/e2e/test_driver.py rename to pysql-connector/tests/e2e/test_driver.py diff --git a/tests/e2e/test_parameterized_queries.py b/pysql-connector/tests/e2e/test_parameterized_queries.py similarity index 100% rename from tests/e2e/test_parameterized_queries.py rename to pysql-connector/tests/e2e/test_parameterized_queries.py diff --git a/tests/unit/__init__.py b/pysql-connector/tests/unit/__init__.py similarity index 100% rename from tests/unit/__init__.py rename to pysql-connector/tests/unit/__init__.py diff --git a/tests/unit/test_arrow_queue.py b/pysql-connector/tests/unit/test_arrow_queue.py similarity index 100% rename from tests/unit/test_arrow_queue.py rename to pysql-connector/tests/unit/test_arrow_queue.py diff --git a/tests/unit/test_auth.py b/pysql-connector/tests/unit/test_auth.py similarity index 100% rename from tests/unit/test_auth.py rename to pysql-connector/tests/unit/test_auth.py diff --git a/tests/unit/test_client.py b/pysql-connector/tests/unit/test_client.py similarity index 100% rename from tests/unit/test_client.py rename to pysql-connector/tests/unit/test_client.py diff --git a/tests/unit/test_cloud_fetch_queue.py b/pysql-connector/tests/unit/test_cloud_fetch_queue.py similarity index 100% rename from tests/unit/test_cloud_fetch_queue.py rename to pysql-connector/tests/unit/test_cloud_fetch_queue.py diff --git a/tests/unit/test_download_manager.py b/pysql-connector/tests/unit/test_download_manager.py similarity index 100% rename from tests/unit/test_download_manager.py rename to pysql-connector/tests/unit/test_download_manager.py diff --git a/tests/unit/test_downloader.py b/pysql-connector/tests/unit/test_downloader.py similarity index 100% rename from tests/unit/test_downloader.py rename to pysql-connector/tests/unit/test_downloader.py diff --git a/tests/unit/test_endpoint.py b/pysql-connector/tests/unit/test_endpoint.py similarity index 100% rename from tests/unit/test_endpoint.py rename to pysql-connector/tests/unit/test_endpoint.py diff --git a/tests/unit/test_fetches.py b/pysql-connector/tests/unit/test_fetches.py similarity index 100% rename from tests/unit/test_fetches.py rename to pysql-connector/tests/unit/test_fetches.py diff --git a/tests/unit/test_fetches_bench.py b/pysql-connector/tests/unit/test_fetches_bench.py similarity index 100% rename from tests/unit/test_fetches_bench.py rename to pysql-connector/tests/unit/test_fetches_bench.py diff --git a/tests/unit/test_init_file.py b/pysql-connector/tests/unit/test_init_file.py similarity index 100% rename from tests/unit/test_init_file.py rename to pysql-connector/tests/unit/test_init_file.py diff --git a/tests/unit/test_oauth_persistence.py b/pysql-connector/tests/unit/test_oauth_persistence.py similarity index 100% rename from tests/unit/test_oauth_persistence.py rename to pysql-connector/tests/unit/test_oauth_persistence.py diff --git a/tests/unit/test_param_escaper.py b/pysql-connector/tests/unit/test_param_escaper.py similarity index 100% rename from tests/unit/test_param_escaper.py rename to pysql-connector/tests/unit/test_param_escaper.py diff --git a/tests/unit/test_parameters.py b/pysql-connector/tests/unit/test_parameters.py similarity index 100% rename from tests/unit/test_parameters.py rename to pysql-connector/tests/unit/test_parameters.py diff --git a/tests/unit/test_retry.py b/pysql-connector/tests/unit/test_retry.py similarity index 100% rename from tests/unit/test_retry.py rename to pysql-connector/tests/unit/test_retry.py diff --git a/tests/unit/test_thrift_backend.py b/pysql-connector/tests/unit/test_thrift_backend.py similarity index 100% rename from tests/unit/test_thrift_backend.py rename to pysql-connector/tests/unit/test_thrift_backend.py From edcdcd45c0d146643e121baf055ca3bd75517287 Mon Sep 17 00:00:00 2001 From: Shivam Raj Date: Wed, 3 Jul 2024 15:56:52 +0530 Subject: [PATCH 2/3] Dialect test command corrected --- .gitignore | 5 ++++- sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f42d46fa..4bffc75c 100644 --- a/.gitignore +++ b/.gitignore @@ -210,4 +210,7 @@ build/ test.env #intellij stuff -.idea \ No newline at end of file +.idea + +# don't commit authentication info to source control +*.env diff --git a/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md b/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md index d005daa3..1531968d 100644 --- a/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md +++ b/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md @@ -25,7 +25,7 @@ We maintain `_extra.py` with test cases that depend on SQLAlchemy's reusable dia poetry shell cd src/databricks/sqlalchemy/test python -m pytest test_suite.py --dburi \ - "databricks://token:$access_token@$host?http_path=$http_path&catalog=$catalog&schema=$schema" + "databricks://token:$access_token@$host?http_path=$http_path&catalog=$catalog&schema=$schema -c ../setup.cfg" ``` Whatever schema you pass in the `dburi` argument should be empty. Some tests also require the presence of an empty schema named `test_schema`. Note that we plan to implement our own `provision.py` which SQLAlchemy can automatically use to create an empty schema for testing. But for now this is a manual process. From 4aed5678cd6eaba8662b5de7e9775f05197160b8 Mon Sep 17 00:00:00 2001 From: Shivam Raj Date: Wed, 3 Jul 2024 16:11:19 +0530 Subject: [PATCH 3/3] test config added in projects --- pysql-connector/pyproject.toml | 14 +++++++------- sqlalchemy-plugin/pyproject.toml | 10 +++++++++- .../src/sqlalchemy_db/README.sqlalchemy.md | 4 ++++ .../src/sqlalchemy_db/README.tests.md | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pysql-connector/pyproject.toml b/pysql-connector/pyproject.toml index 629f2d32..2412dd55 100644 --- a/pysql-connector/pyproject.toml +++ b/pysql-connector/pyproject.toml @@ -57,10 +57,10 @@ exclude = ['ttypes\.py$', 'TCLIService\.py$'] [tool.black] exclude = '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist|thrift_api)/' -#[tool.pytest.ini_options] -#markers = {"reviewed" = "Test case has been reviewed by Databricks"} -#minversion = "6.0" -#log_cli = "false" -#log_cli_level = "INFO" -#testpaths = ["tests", "src/databricks/sqlalchemy/test_local"] -#env_files = ["test.env"] +[tool.pytest.ini_options] +markers = {"reviewed" = "Test case has been reviewed by Databricks"} +minversion = "6.0" +log_cli = "false" +log_cli_level = "INFO" +testpaths = ["tests"] +env_files = ["test.env"] \ No newline at end of file diff --git a/sqlalchemy-plugin/pyproject.toml b/sqlalchemy-plugin/pyproject.toml index 98ab20a1..2dce9886 100644 --- a/sqlalchemy-plugin/pyproject.toml +++ b/sqlalchemy-plugin/pyproject.toml @@ -35,4 +35,12 @@ ignore_missing_imports = "true" exclude = ['ttypes\.py$', 'TCLIService\.py$'] [tool.black] -exclude = '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist|thrift_api)/' \ No newline at end of file +exclude = '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|\.svn|_build|buck-out|build|dist|thrift_api)/' + +[tool.pytest.ini_options] +markers = {"reviewed" = "Test case has been reviewed by Databricks"} +minversion = "6.0" +log_cli = "false" +log_cli_level = "INFO" +testpaths = ["src/sqlalchemy_db/test_local"] +env_files = ["test.env"] \ No newline at end of file diff --git a/sqlalchemy-plugin/src/sqlalchemy_db/README.sqlalchemy.md b/sqlalchemy-plugin/src/sqlalchemy_db/README.sqlalchemy.md index 2bb79ff9..5ed5c910 100644 --- a/sqlalchemy-plugin/src/sqlalchemy_db/README.sqlalchemy.md +++ b/sqlalchemy-plugin/src/sqlalchemy_db/README.sqlalchemy.md @@ -10,6 +10,10 @@ A SQLAlchemy 1.4 compatible dialect was first released in connector [version 2.4 To install the dialect and its dependencies: +```shell +pip install databricks-sqlalchemy-dialect +``` +or ```shell pip install databricks-sql-connector[sqlalchemy] ``` diff --git a/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md b/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md index 1531968d..97744a5e 100644 --- a/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md +++ b/sqlalchemy-plugin/src/sqlalchemy_db/README.tests.md @@ -23,7 +23,7 @@ We maintain `_extra.py` with test cases that depend on SQLAlchemy's reusable dia ``` poetry shell -cd src/databricks/sqlalchemy/test +cd sqlalchemy-plugin/src/sqlalchemy_db/test python -m pytest test_suite.py --dburi \ "databricks://token:$access_token@$host?http_path=$http_path&catalog=$catalog&schema=$schema -c ../setup.cfg" ```