Skip to content

Commit

Permalink
Fix error when column_reflection_fallback returns no type
Browse files Browse the repository at this point in the history
  • Loading branch information
TrangPham authored and alena-hutchinson committed Dec 19, 2024
1 parent 14a361d commit 1dcb31d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions great_expectations/expectations/metrics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
overload,
)

import great_expectations.exceptions as gx_exceptions
import numpy as np
from dateutil.parser import parse
from packaging import version

import great_expectations.exceptions as gx_exceptions
from great_expectations.compatibility import aws, sqlalchemy, trino
from great_expectations.compatibility.sqlalchemy import (
sqlalchemy as sa,
Expand All @@ -40,6 +38,7 @@
GXSqlDialect,
)
from great_expectations.execution_engine.util import check_sql_engine_dialect
from packaging import version

try:
import psycopg2 # noqa: F401
Expand Down Expand Up @@ -76,9 +75,10 @@


if TYPE_CHECKING:
import pandas as pd
from typing_extensions import TypeAlias

import pandas as pd

try:
import teradatasqlalchemy.dialect
import teradatasqlalchemy.types as teradatatypes
Expand Down Expand Up @@ -418,7 +418,10 @@ def get_sqlalchemy_column_metadata( # noqa: C901
# 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)
if column.get("type"):
# When using column_reflection_fallback, we might not be able to
# extract the column type, and only have the column name
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
Expand Down

0 comments on commit 1dcb31d

Please sign in to comment.