From f207322f7a3d48ef72e076717d959ed61609a4ab Mon Sep 17 00:00:00 2001 From: Pradeep Srikakolapu Date: Sat, 4 May 2024 23:43:57 -0700 Subject: [PATCH] Releasing 1.7.0-rc1 --- dbt/adapters/fabricspark/__version__.py | 2 +- dbt/adapters/fabricspark/impl.py | 20 +++++++++++++ dev-requirements.txt | 4 +-- setup.py | 2 +- tests/functional/adapter/basic/test_base.py | 28 +++++++++++++++++++ .../adapter/basic/test_snapshot_check_cols.py | 6 ++-- .../adapter/basic/test_snapshot_timestamp.py | 2 +- 7 files changed, 56 insertions(+), 8 deletions(-) diff --git a/dbt/adapters/fabricspark/__version__.py b/dbt/adapters/fabricspark/__version__.py index 1d2630c..21a042b 100644 --- a/dbt/adapters/fabricspark/__version__.py +++ b/dbt/adapters/fabricspark/__version__.py @@ -1 +1 @@ -version = "1.7.0" +version = "1.7.0rc1" diff --git a/dbt/adapters/fabricspark/impl.py b/dbt/adapters/fabricspark/impl.py index 2cf7fac..521e9d8 100644 --- a/dbt/adapters/fabricspark/impl.py +++ b/dbt/adapters/fabricspark/impl.py @@ -435,6 +435,26 @@ def get_rows_different_sql( ) return sql + + def run_sql_for_tests(self, sql, fetch, conn): + cursor = conn.handle.cursor() + try: + cursor.execute(sql) + if fetch == "one": + if hasattr(cursor, "fetchone"): + return cursor.fetchone() + else: + return cursor.fetchall()[0] + elif fetch == "all": + return cursor.fetchall() + else: + return + except BaseException as e: + print(sql) + print(e) + raise + finally: + conn.transaction_open = False def standardize_grants_dict(self, grants_table: agate.Table) -> dict: grants_dict: Dict[str, List[str]] = {} diff --git a/dev-requirements.txt b/dev-requirements.txt index 2a2bca7..e97c011 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,7 +1,7 @@ # install latest changes in dbt-core # TODO: how to automate switching from develop to version branches? -git+https://github.com/dbt-labs/dbt-core.git@v1.7.4#egg=dbt-core&subdirectory=core -git+https://github.com/dbt-labs/dbt-core.git@v1.7.4#egg=dbt-tests-adapter&subdirectory=tests/adapter +git+https://github.com/dbt-labs/dbt-core.git@v1.7.10#egg=dbt-core&subdirectory=core +git+https://github.com/dbt-labs/dbt-core.git@v1.7.10#egg=dbt-tests-adapter&subdirectory=tests/adapter # if version 1.x or greater -> pin to major version # if version 0.x -> pin to minor diff --git a/setup.py b/setup.py index 324bfb3..dcf6bc9 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ def _get_dbt_core_version(): package_name = "dbt-fabricspark" -package_version = "1.7.0" +package_version = "1.7.0rc1" dbt_core_version = _get_dbt_core_version() print(f"printing version --------- {dbt_core_version}") description = """The Apache Spark adapter plugin for dbt""" diff --git a/tests/functional/adapter/basic/test_base.py b/tests/functional/adapter/basic/test_base.py index 915d5ac..8573c91 100644 --- a/tests/functional/adapter/basic/test_base.py +++ b/tests/functional/adapter/basic/test_base.py @@ -6,9 +6,37 @@ check_relation_types, check_relations_equal, ) +from dbt.tests.adapter.basic.files import ( + seeds_base_csv, + base_view_sql, + base_table_sql, + base_materialized_var_sql, + schema_base_yml, +) class BaseSimpleMaterializations: + @pytest.fixture(scope="class") + def models(self): + return { + "view_model.sql": base_view_sql, + "table_model.sql": base_table_sql, + "swappable.sql": base_materialized_var_sql, + "schema.yml": schema_base_yml, + } + + @pytest.fixture(scope="class") + def seeds(self): + return { + "base.csv": seeds_base_csv, + } + + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "name": "base", + } + @pytest.fixture(scope="class") def dbt_profile_data(unique_schema, dbt_profile_target, profiles_config_update): profile = { diff --git a/tests/functional/adapter/basic/test_snapshot_check_cols.py b/tests/functional/adapter/basic/test_snapshot_check_cols.py index 64472b4..4313470 100644 --- a/tests/functional/adapter/basic/test_snapshot_check_cols.py +++ b/tests/functional/adapter/basic/test_snapshot_check_cols.py @@ -30,9 +30,9 @@ def seeds(self): @pytest.fixture(scope="class") def snapshots(self): return { - "cc_all_snapshot.sql": cc_all_snapshot_sql.replace("target_database=database","target_database=\"test\"").replace("target_schema=schema","target_schema=\"test\""), - "cc_date_snapshot.sql": cc_date_snapshot_sql.replace("target_database=database","target_database=\"test\"").replace("target_schema=schema","target_schema=\"test\""), - "cc_name_snapshot.sql": cc_name_snapshot_sql.replace("target_database=database","target_database=\"test\"").replace("target_schema=schema","target_schema=\"test\""), + "cc_all_snapshot.sql": cc_all_snapshot_sql.replace("target_database=database","target_database=\"dbttest\"").replace("target_schema=schema","target_schema=\"dbttest\""), + "cc_date_snapshot.sql": cc_date_snapshot_sql.replace("target_database=database","target_database=\"dbttest\"").replace("target_schema=schema","target_schema=\"dbttest\""), + "cc_name_snapshot.sql": cc_name_snapshot_sql.replace("target_database=database","target_database=\"dbttest\"").replace("target_schema=schema","target_schema=\"dbttest\""), } @pytest.fixture(scope="class") diff --git a/tests/functional/adapter/basic/test_snapshot_timestamp.py b/tests/functional/adapter/basic/test_snapshot_timestamp.py index ac233c7..822641f 100644 --- a/tests/functional/adapter/basic/test_snapshot_timestamp.py +++ b/tests/functional/adapter/basic/test_snapshot_timestamp.py @@ -45,7 +45,7 @@ def seeds(self): @pytest.fixture(scope="class") def snapshots(self): return { - "ts_snapshot.sql": ts_snapshot_sql.replace("target_database=database","target_database=\"test\"").replace("target_schema=schema","target_schema=\"test\""), + "ts_snapshot.sql": ts_snapshot_sql.replace("target_database=database","target_database=\"dbttest\"").replace("target_schema=schema","target_schema=\"dbttest\""), } @pytest.fixture(scope="class")