Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2024
1 parent 7ef088f commit 24d9b67
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 31 deletions.
24 changes: 12 additions & 12 deletions great_expectations/compatibility/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 11 in great_expectations/compatibility/postgresql.py

View check run for this annotation

Codecov / codecov/patch

great_expectations/compatibility/postgresql.py#L11

Added line #L11 was not covered by tests
except ImportError:
postgresqltypes = POSTGRESQL_NOT_IMPORTED

Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions great_expectations/expectations/metrics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Check warning on line 423 in great_expectations/expectations/metrics/util.py

View check run for this annotation

Codecov / codecov/patch

great_expectations/expectations/metrics/util.py#L422-L423

Added lines #L422 - L423 were not covered by tests
# 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

Check warning on line 428 in great_expectations/expectations/metrics/util.py

View check run for this annotation

Codecov / codecov/patch

great_expectations/expectations/metrics/util.py#L428

Added line #L428 was not covered by tests
return columns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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
assert result_dict["observed_value"] in expectation.type_list

0 comments on commit 24d9b67

Please sign in to comment.