dbt-labs / dbt-adapters

Apache License 2.0
17 stars 20 forks source link

[Bug] Incorrect type hints for `get_adapter_constraint_support` #253

Open b-per opened 1 month ago

b-per commented 1 month ago

Is this a new bug in dbt-core?

Current Behavior

I was debugging some issues with a third party tool calling the dbt Core API and digging in the code, I think that the type hint for the return value for the function get_adapter_constraint_support is incorrect.

It currently says List[str]

https://github.com/dbt-labs/dbt-adapters/blob/8ff69435a753f0a94dd1274d0e8dad199805cd13/dbt/adapters/factory.py#L191-L192

but in another part of the code, we access it as a dict.

https://github.com/dbt-labs/dbt-core/blob/71a8a411047cb6e2bd73a75c8a3c0bb8f9c2dbbb/core/dbt/contracts/graph/nodes.py#L649

https://github.com/dbt-labs/dbt-core/blob/71a8a411047cb6e2bd73a75c8a3c0bb8f9c2dbbb/core/dbt/contracts/graph/nodes.py#L682-L682

Looking at how the Constraints are defined in one of the adapters (BQ here), it looks like it is indeed a dict:

https://github.com/dbt-labs/dbt-bigquery/blob/e67848972cce8ab51d68c6d1b1ced0f75816108c/dbt/adapters/bigquery/impl.py#L134-L140

I just realized that the type hint is defined in dbt-adapter so feel free to move the issue there.

Expected Behavior

The type hint is correct

Steps To Reproduce

See example of code above

Relevant log output

No response

Environment

No response

Which database adapter are you using with dbt?

No response

Additional Context

No response