-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Metric
table.column_type
should properly evaluate for Post…
…gres (#10793) Co-authored-by: Thu Pham <thu.pham@greatexpectations.io> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
17c2383
commit ab0a7f7
Showing
6 changed files
with
206 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from __future__ import annotations | ||
|
||
from great_expectations.compatibility.not_imported import NotImported | ||
|
||
POSTGRESQL_NOT_IMPORTED = NotImported( | ||
"postgresql connection components are not installed, please 'pip install psycopg2'" | ||
) | ||
|
||
try: | ||
import psycopg2 # noqa: F401 | ||
import sqlalchemy.dialects.postgresql as postgresqltypes | ||
except ImportError: | ||
postgresqltypes = POSTGRESQL_NOT_IMPORTED # type: ignore[assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import TEXT | ||
except (ImportError, AttributeError): | ||
TEXT = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import CHAR | ||
except (ImportError, AttributeError): | ||
CHAR = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import INTEGER | ||
except (ImportError, AttributeError): | ||
INTEGER = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import SMALLINT | ||
except (ImportError, AttributeError): | ||
SMALLINT = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import BIGINT | ||
except (ImportError, AttributeError): | ||
BIGINT = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import TIMESTAMP | ||
except (ImportError, AttributeError): | ||
TIMESTAMP = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import DATE | ||
except (ImportError, AttributeError): | ||
DATE = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import DOUBLE_PRECISION | ||
except (ImportError, AttributeError): | ||
DOUBLE_PRECISION = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import BOOLEAN | ||
except (ImportError, AttributeError): | ||
BOOLEAN = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
try: | ||
from sqlalchemy.dialects.postgresql import NUMERIC | ||
except (ImportError, AttributeError): | ||
NUMERIC = POSTGRESQL_NOT_IMPORTED # type: ignore[misc, assignment] | ||
|
||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters