Skip to content

Failing test_connection in TableAsset.test_connection for uppercase schema name defined in SQL Server / mssql #10499

@amirulmenjeni

Description

@amirulmenjeni

Using GX Core version: 1.1.1

Currently I'm not able to create a table data asset from the SQLDatasource's add_table_asset method when the schema of the table I'm trying to connect to is defined in the database in the uppercase form (e.g., MY_SCHEMA):

datasource.add_table_asset(
    name="asset-name", 
    schema_name="S_EC",
    table_name="my_table",
)

Instead I got the following error:

great_expectations.datasource.fluent.interfaces.TestConnectionError: Attempt to connect to table: "my_schema.my_table" failed because the schema "my_schema" does not exist

Looking at the lines below it seems that the self.schema_name not in inspector.get_schema_names() check doesn't do case insensitive comparison.

https://github.com/great-expectations/great_expectations/blob/f9aa879a3d3ef0750bd72a24a003ea5631a6f29e/great_expectations/datasource/fluent/sql_datasource.py#L908-L912

Attempting to bracket the schema with quote characters (e.g., 'MY_SCHEMA') does persist the uppercase, but the test fails as well, complaining:

great_expectations.datasource.fluent.interfaces.TestConnectionError: Attempt to connect to table: ""MY_SCHEMA".my_table" failed because the schema ""MY_SCHEMA"" does not exist

I can still create query asset with add_query_asset method, though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions