Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Fix type handling of key_columns in toml #653

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

Attsun1031
Copy link
Contributor

This PR will fix #372.

This issue is automatically closed, but not resolved yet.

Cause of the issue

toml.load loads array field in toml as list type, but TableSegment class requires key_columns as tuple type and runtype.dataclass reports error.

Test

Prepare configuration as below:

[run.model_test]
  # Source 1 ("left")
  1.database = "postgres_connection"
  1.table = "table1"

  # Source 2 ("right")
  2.database = "postgres_connection"
  2.table = "table2"

  key_columns = ["uuid",]
  columns = ["age", "name"]

It doesn't work at 0.7.14 version,

$ poetry run data-diff --conf datadiff.toml --run model
18:26:57 ERROR    [TableSegment] Attribute 'key_columns' expected value of type tuple[str]. Instead got ['uuid']

and it works at this branch. (no diff)

$ poetry run data-diff --conf datadiff.toml --run model
$ echo $?
0

@Attsun1031 Attsun1031 marked this pull request as ready for review July 24, 2023 09:37
@dlawin dlawin requested review from nolar and dlawin July 27, 2023 15:42
@dlawin dlawin added the bug Something isn't working label Jul 27, 2023
@dlawin dlawin force-pushed the fix-key-columns-handling branch from 7e6470d to 2a78561 Compare July 27, 2023 15:43
@dlawin dlawin merged commit de92abc into datafold:master Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config key - key_columns throws error when used in TOML
2 participants