From ca5b1719d6362ed237b111f2c0e2b3a3899a9e54 Mon Sep 17 00:00:00 2001 From: Pradeep Srikakolapu Date: Mon, 11 Sep 2023 00:29:06 -0700 Subject: [PATCH] dbt 1.6.0 update --- .github/workflows/integration-tests-azure.yml | 2 +- .github/workflows/publish-docker.yml | 4 ++-- .github/workflows/release-version.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- CHANGELOG.md | 16 +++++++++++++++ dbt/adapters/fabric/__version__.py | 2 +- .../fabric/fabric_connection_manager.py | 4 ++-- dev_requirements.txt | 6 +++--- setup.py | 4 ++-- tests/functional/adapter/test_debug.py | 20 ++++++++++++++++++- tests/functional/adapter/test_equals.py | 5 +++++ tests/functional/adapter/test_null_compare.py | 9 +++++++++ 12 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 tests/functional/adapter/test_equals.py create mode 100644 tests/functional/adapter/test_null_compare.py diff --git a/.github/workflows/integration-tests-azure.yml b/.github/workflows/integration-tests-azure.yml index e47b3129..8d401359 100644 --- a/.github/workflows/integration-tests-azure.yml +++ b/.github/workflows/integration-tests-azure.yml @@ -27,7 +27,7 @@ jobs: AZURE_CLIENT_SECRET: ${{ secrets.DBT_AZURE_SP_SECRET }} AZURE_TENANT_ID: ${{ secrets.DBT_AZURE_TENANT }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: pip install -r dev_requirements.txt diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 41f76798..e332337f 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -21,7 +21,7 @@ jobs: packages: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@v2.2.0 @@ -31,7 +31,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image - uses: docker/build-push-action@v4.0.0 + uses: docker/build-push-action@v4.2.1 with: context: devops build-args: PYTHON_VERSION=${{ matrix.python_version }} diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index 1273d2a4..c786f9be 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -11,7 +11,7 @@ jobs: name: Release new version runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7bc9246b..b0fdc9e1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -28,7 +28,7 @@ jobs: password: ${{ secrets.github_token }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: pip install -r dev_requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index b9995a47..33e708e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +### v1.6.0 + +## Features + +* Supporting dbt-core 1.6.2 +* Adding limit - new args to adapter.execute() function +* Added tests related to dbt-debug to test --connection parameter +* Added adapter zone tests + +## Dependencies + +* Bump from pytest==7.4.0 to pytest==7.4.2 +* Bump from pre-commit==3.3.3 to 3.4.0 +* Bump from dbt-tests-adapter~=1.5.2 to 1.6.2 +* Bump from actions@v3 to v4 +* Bump from build-push-action@v4.0.0 to 4.2.1 ### v1.5.0 Releasing 1.5 version for dbt-cloud integration. diff --git a/dbt/adapters/fabric/__version__.py b/dbt/adapters/fabric/__version__.py index e3a0f015..38ec8ede 100644 --- a/dbt/adapters/fabric/__version__.py +++ b/dbt/adapters/fabric/__version__.py @@ -1 +1 @@ -version = "1.5.0" +version = "1.6.0" diff --git a/dbt/adapters/fabric/fabric_connection_manager.py b/dbt/adapters/fabric/fabric_connection_manager.py index 6c6d07c8..d045e874 100644 --- a/dbt/adapters/fabric/fabric_connection_manager.py +++ b/dbt/adapters/fabric/fabric_connection_manager.py @@ -496,7 +496,7 @@ def data_type_code_to_name(cls, type_code: Union[str, str]) -> str: return datatypes[data_type] def execute( - self, sql: str, auto_begin: bool = True, fetch: bool = False + self, sql: str, auto_begin: bool = True, fetch: bool = False, limit: Optional[int] = None ) -> Tuple[AdapterResponse, agate.Table]: _, cursor = self.add_query(sql, auto_begin) response = self.get_response(cursor) @@ -505,7 +505,7 @@ def execute( while cursor.description is None: if not cursor.nextset(): break - table = self.get_result_from_cursor(cursor) + table = self.get_result_from_cursor(cursor, limit) else: table = empty_table() # Step through all result sets so we process all errors diff --git a/dev_requirements.txt b/dev_requirements.txt index 8b3745a0..268c00a6 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,10 +1,10 @@ -pytest==7.4.0 +pytest==7.4.2 twine==4.0.2 wheel==0.41.1 pre-commit==2.21.0;python_version<"3.8" -pre-commit==3.3.3;python_version>="3.8" +pre-commit==3.4.0;python_version>="3.8" pytest-dotenv==0.5.2 -dbt-tests-adapter~=1.5.2 +dbt-tests-adapter~=1.6.2 flaky==3.7.0 pytest-xdist==3.3.1 -e . diff --git a/setup.py b/setup.py index 69cd83da..706f21a3 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ package_name = "dbt-fabric" authors_list = ["Pradeep Srikakolapu"] -dbt_version = "1.5" +dbt_version = "1.6" description = """A Microsoft Fabric Synapse Data Warehouse adapter plugin for dbt""" this_directory = os.path.abspath(os.path.dirname(__file__)) @@ -66,7 +66,7 @@ def run(self): packages=find_namespace_packages(include=["dbt", "dbt.*"]), include_package_data=True, install_requires=[ - "dbt-core~=1.5.2", + "dbt-core~=1.6.2", "pyodbc~=4.0.35,!=4.0.36,!=4.0.37", "azure-identity>=1.12.0", ], diff --git a/tests/functional/adapter/test_debug.py b/tests/functional/adapter/test_debug.py index 990b467a..8c891502 100644 --- a/tests/functional/adapter/test_debug.py +++ b/tests/functional/adapter/test_debug.py @@ -5,7 +5,7 @@ import yaml from dbt.cli.exceptions import DbtUsageException from dbt.tests.adapter.dbt_debug.test_dbt_debug import BaseDebug, BaseDebugProfileVariable -from dbt.tests.util import run_dbt +from dbt.tests.util import run_dbt, run_dbt_and_capture class TestDebugFabric(BaseDebug): @@ -17,6 +17,24 @@ def test_nopass(self, project): run_dbt(["debug", "--target", "nopass"], expect_pass=False) self.assertGotValue(re.compile(r"\s+profiles\.yml file"), "ERROR invalid") + def test_connection_flag(self, project): + """Testing that the --connection flag works as expected, including that output is not lost""" + _, out = run_dbt_and_capture(["debug", "--connection"]) + assert "Skipping steps before connection verification" in out + + _, out = run_dbt_and_capture( + ["debug", "--connection", "--target", "NONE"], expect_pass=False + ) + assert "1 check failed" in out + assert "The profile 'test' does not have a target named 'NONE'." in out + + _, out = run_dbt_and_capture( + ["debug", "--connection", "--profiles-dir", "NONE"], expect_pass=False + ) + assert "Using profiles dir at NONE" + assert "1 check failed" in out + assert "dbt looked for a profiles.yml file in NONE" in out + def test_wronguser(self, project): run_dbt(["debug", "--target", "wronguser"], expect_pass=False) self.assertGotValue(re.compile(r"\s+Connection test"), "ERROR") diff --git a/tests/functional/adapter/test_equals.py b/tests/functional/adapter/test_equals.py new file mode 100644 index 00000000..7a80625c --- /dev/null +++ b/tests/functional/adapter/test_equals.py @@ -0,0 +1,5 @@ +from dbt.tests.adapter.utils.test_equals import BaseEquals + + +class TestEqualsFabric(BaseEquals): + pass diff --git a/tests/functional/adapter/test_null_compare.py b/tests/functional/adapter/test_null_compare.py new file mode 100644 index 00000000..f0027a42 --- /dev/null +++ b/tests/functional/adapter/test_null_compare.py @@ -0,0 +1,9 @@ +from dbt.tests.adapter.utils.test_null_compare import BaseMixedNullCompare, BaseNullCompare + + +class TestMixedNullCompareFabric(BaseMixedNullCompare): + pass + + +class TestNullCompareFabric(BaseNullCompare): + pass