From 24d9b67ff375f837966f300b338ad0f915508096 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:22:16 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../compatibility/postgresql.py | 24 +++++++++---------- .../expectations/metrics/util.py | 6 ++--- ...expect_column_values_to_be_in_type_list.py | 22 +++++------------ 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/great_expectations/compatibility/postgresql.py b/great_expectations/compatibility/postgresql.py index 45d96c58f44f..5494b20c8d35 100644 --- a/great_expectations/compatibility/postgresql.py +++ b/great_expectations/compatibility/postgresql.py @@ -3,12 +3,12 @@ from great_expectations.compatibility.not_imported import NotImported POSTGRESQL_NOT_IMPORTED = NotImported( - "postgresql connection components are not installed, please 'pip install psycopg2'" # noqa: E501 + "postgresql connection components are not installed, please 'pip install psycopg2'" ) try: import psycopg2 # noqa: F401 - import sqlalchemy.dialects.postgresql as postgresqltypes # noqa: TID251 + import sqlalchemy.dialects.postgresql as postgresqltypes except ImportError: postgresqltypes = POSTGRESQL_NOT_IMPORTED @@ -66,13 +66,13 @@ class POSTGRESQL_TYPES: """Namespace for PostgreSQL dialect types.""" - TEXT=TEXT - CHAR=CHAR - INTEGER=INTEGER - SMALLINT=SMALLINT - BIGINT=BIGINT - TIMESTAMP=TIMESTAMP - DATE=DATE - DOUBLE_PRECISION=DOUBLE_PRECISION - BOOLEAN=BOOLEAN - NUMERIC=NUMERIC + TEXT = TEXT + CHAR = CHAR + INTEGER = INTEGER + SMALLINT = SMALLINT + BIGINT = BIGINT + TIMESTAMP = TIMESTAMP + DATE = DATE + DOUBLE_PRECISION = DOUBLE_PRECISION + BOOLEAN = BOOLEAN + NUMERIC = NUMERIC diff --git a/great_expectations/expectations/metrics/util.py b/great_expectations/expectations/metrics/util.py index 03299c22f05b..37d49dfad490 100644 --- a/great_expectations/expectations/metrics/util.py +++ b/great_expectations/expectations/metrics/util.py @@ -421,9 +421,9 @@ def get_sqlalchemy_column_metadata( # noqa: C901 column["type"] = column["type"].compile(dialect=execution_engine.dialect) if dialect_name == GXSqlDialect.SNOWFLAKE: return [ - # TODO: SmartColumn should know the dialect and do lookups based on that - CaseInsensitiveNameDict(column) - for column in columns_copy + # TODO: SmartColumn should know the dialect and do lookups based on that + CaseInsensitiveNameDict(column) + for column in columns_copy ] return columns_copy return columns diff --git a/tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_be_in_type_list.py b/tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_be_in_type_list.py index def310226ad9..5b5f8c8f42da 100644 --- a/tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_be_in_type_list.py +++ b/tests/integration/data_sources_and_expectations/expectations/test_expect_column_values_to_be_in_type_list.py @@ -388,21 +388,15 @@ def test_success_complete_snowflake( "expectation", [ pytest.param( - gxe.ExpectColumnValuesToBeInTypeList( - column="CHAR", type_list=["CHAR", "CHAR(1)"] - ), + gxe.ExpectColumnValuesToBeInTypeList(column="CHAR", type_list=["CHAR", "CHAR(1)"]), id="CHAR", ), pytest.param( - gxe.ExpectColumnValuesToBeInTypeList( - column="TEXT", type_list=["TEXT"] - ), + gxe.ExpectColumnValuesToBeInTypeList(column="TEXT", type_list=["TEXT"]), id="TEXT", ), pytest.param( - gxe.ExpectColumnValuesToBeInTypeList( - column="INTEGER", type_list=["INTEGER"] - ), + gxe.ExpectColumnValuesToBeInTypeList(column="INTEGER", type_list=["INTEGER"]), id="INTEGER", ), pytest.param( @@ -420,9 +414,7 @@ def test_success_complete_snowflake( id="TIMESTAMP", ), pytest.param( - gxe.ExpectColumnValuesToBeInTypeList( - column="DATE", type_list=["DATE"] - ), + gxe.ExpectColumnValuesToBeInTypeList(column="DATE", type_list=["DATE"]), id="DATE", ), pytest.param( @@ -432,9 +424,7 @@ def test_success_complete_snowflake( id="DOUBLE_PRECISION", ), pytest.param( - gxe.ExpectColumnValuesToBeInTypeList( - column="BOOLEAN", type_list=["BOOLEAN"] - ), + gxe.ExpectColumnValuesToBeInTypeList(column="BOOLEAN", type_list=["BOOLEAN"]), id="BOOLEAN", ), pytest.param( @@ -495,4 +485,4 @@ def test_success_complete_postgres( assert isinstance(result_dict, dict) assert isinstance(result_dict["observed_value"], str) assert isinstance(expectation.type_list, list) - assert result_dict["observed_value"] in expectation.type_list \ No newline at end of file + assert result_dict["observed_value"] in expectation.type_list