-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Data can be copied into wrong columns #116
Comments
@visch this is a good catch - my initial understanding was that since we're using JSON files the order wouldnt matter because we're selecting them explicitly by name but that doesnt seem to be true. I personally havent run into this so maybe ordering is mostly consistent for taps 🤷 .
Yeah I like that idea. So adding (i.e.
Then if the table is in order col1, col2, col3 I think this would still work even though columns are out of order in the select since we're explicit. Another example - https://docs.snowflake.com/en/user-guide/data-load-transform#load-a-subset-of-table-data |
Closes #116 I created a new test that creates a table then sends singer records that are in a different order. The current implementation causes the test to fail because https://github.com/MeltanoLabs/target-snowflake/actions/runs/6160685807/job/16718219357 its trying to put a string in a boolean column. After implementing Derek's suggested fix to explicitly define column names in the copy into statement, the tests pass. cc @visch
Because the copy into doesn't specify the column order if the columns list in the schema doesn't match the order in the table in snowflake exactly you can have some issues. I hit this as we were migrating an existing table to use
target-snowflake
. Related code here https://github.com/MeltanoLabs/target-snowflake/blob/main/target_snowflake/connector.py#L355-L358 , I recommend we swap to explicitly defining the column names in thecopy into
(https://docs.snowflake.com/en/sql-reference/sql/copy-into-table) statement, maybe there's a better way?copy into sql example that gets generated by the target
To reproduce
example_1
Run
cat example_1 | meltano invoke target-snowflake
example_2
Run
cat example_2 | meltano invoke target-snowflake
You'll get
The text was updated successfully, but these errors were encountered: