Skip to content

Commit

Permalink
handle postgres dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
alena-hutchinson committed Dec 18, 2024
1 parent 89ba44b commit b3ac284
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions great_expectations/expectations/metrics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,18 @@ def get_sqlalchemy_column_metadata( # noqa: C901
)

dialect_name = execution_engine.dialect.name
if dialect_name == GXSqlDialect.SNOWFLAKE:
if dialect_name in [GXSqlDialect.POSTGRESQL, GXSqlDialect.SNOWFLAKE]:
# WARNING: Do not alter columns in place, as they are cached on the inspector
columns_copy = [column.copy() for column in columns]
for column in columns_copy:
column["type"] = column["type"].compile(dialect=execution_engine.dialect)
return [
# TODO: SmartColumn should know the dialect and do lookups based on that
CaseInsensitiveNameDict(column)
for column in columns_copy
]

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
]
return columns_copy
return columns
except AttributeError as e:
logger.debug(f"Error while introspecting columns: {e!r}", exc_info=e)
Expand Down

0 comments on commit b3ac284

Please sign in to comment.