diff --git a/great_expectations/datasource/fluent/sql_datasource.py b/great_expectations/datasource/fluent/sql_datasource.py index f8e2589e2fe4..d71051bad215 100644 --- a/great_expectations/datasource/fluent/sql_datasource.py +++ b/great_expectations/datasource/fluent/sql_datasource.py @@ -1055,8 +1055,15 @@ def test_connection(self) -> None: engine: sqlalchemy.Engine = datasource.get_engine() inspector: sqlalchemy.Inspector = sa.inspect(engine) +<<<<<<< HEAD + if self.schema_name and self.schema_name not in map( + to_lower_if_not_quoted, inspector.get_schema_names() + ): + raise TestConnectionError( # noqa: TRY003 +======= if self.schema_name and self.schema_name not in inspector.get_schema_names(): raise TestConnectionError( # noqa: TRY003 # FIXME CoP +>>>>>>> develop f'Attempt to connect to table: "{self.qualified_name}" failed because the schema ' f'"{self.schema_name}" does not exist.' ) diff --git a/great_expectations/expectations/metrics/table_metrics/table_column_types.py b/great_expectations/expectations/metrics/table_metrics/table_column_types.py index a6abcdcb2e1e..e4f7333aadb1 100644 --- a/great_expectations/expectations/metrics/table_metrics/table_column_types.py +++ b/great_expectations/expectations/metrics/table_metrics/table_column_types.py @@ -87,6 +87,10 @@ def _spark( return spark_column_metadata +def _get_normalized_table_name(table_name: str): + return table_name.strip("[]").strip('"') + + def _get_sqlalchemy_column_metadata( execution_engine: SqlAlchemyExecutionEngine, batch_data: SqlAlchemyBatchData ): @@ -106,7 +110,8 @@ def _get_sqlalchemy_column_metadata( return get_sqlalchemy_column_metadata( execution_engine=execution_engine, - table_selectable=table_selectable, # type: ignore[arg-type] # FIXME CoP + table_selectable=_get_normalized_table_name(table_selectable), # type: ignore[arg-type] + # table_selectable=table_selectable, # type: ignore[arg-type] # FIXME CoP schema_name=schema_name, )