Skip to content
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: default test TargetCamelcaseTest throws IntegrityError #40

Closed
pnadolny13 opened this issue Jun 5, 2023 · 0 comments · Fixed by #46
Closed

bug: default test TargetCamelcaseTest throws IntegrityError #40

pnadolny13 opened this issue Jun 5, 2023 · 0 comments · Fixed by #46
Assignees

Comments

@pnadolny13
Copy link
Contributor

The test throws an IntegrityError. I suspect that the camel casing is breaking this merge sql in that its looking for lowercase id and the RECORD sends Id using camelcase.

sqlalchemy.exc.IntegrityError: (snowflake.connector.errors.IntegrityError) 100072 (22000): None: NULL result in a non-nullable column
E       [SQL: merge into MELTANOLABS_RAW.TARGET_SNOWFLAKE_1CE306.TESTCAMELCASE d using (select $1:id::VARCHAR as ID, $1:clientname::VARCHAR as CLIENTNAME, $1:_sdc_batched_at::TIMESTAMP_NTZ as _SDC_BATCHED_AT, $1:_sdc_extracted_at::TIMESTAMP_NTZ as _SDC_EXTRACTED_AT, $1:_sdc_received_at::TIMESTAMP_NTZ as _SDC_RECEIVED_AT, $1:_sdc_deleted_at::TIMESTAMP_NTZ as _SDC_DELETED_AT, $1:_sdc_table_version::DECIMAL as _SDC_TABLE_VERSION, $1:_sdc_sequence::DECIMAL as _SDC_SEQUENCE from '@~/target-snowflake/TestCamelcase-f581638e-d5bc-42a5-a8ae-cec1d109b3ea'(file_format => MELTANOLABS_RAW.TARGET_SNOWFLAKE_1CE306."TestCamelcase-f581638e-d5bc-42a5-a8ae-cec1d109b3ea")) s on d."ID" = s."ID" when matched then update set d."ID" = s."ID", d."CLIENTNAME" = s."CLIENTNAME", d."_SDC_BATCHED_AT" = s."_SDC_BATCHED_AT", d."_SDC_EXTRACTED_AT" = s."_SDC_EXTRACTED_AT", d."_SDC_RECEIVED_AT" = s."_SDC_RECEIVED_AT", d."_SDC_DELETED_AT" = s."_SDC_DELETED_AT", d."_SDC_TABLE_VERSION" = s."_SDC_TABLE_VERSION", d."_SDC_SEQUENCE" = s."_SDC_SEQUENCE" when not matched then insert (ID, CLIENTNAME, _SDC_BATCHED_AT, _SDC_EXTRACTED_AT, _SDC_RECEIVED_AT, _SDC_DELETED_AT, _SDC_TABLE_VERSION, _SDC_SEQUENCE) values (s."ID", s."CLIENTNAME", s."_SDC_BATCHED_AT", s."_SDC_EXTRACTED_AT", s."_SDC_RECEIVED_AT", s."_SDC_DELETED_AT", s."_SDC_TABLE_VERSION", s."_SDC_SEQUENCE")]
pnadolny13 added a commit that referenced this issue Jun 6, 2023
Closes #28

- implements a fix for the test suites not running properly, also added
it to the SDK meltano/sdk#1749
- implements a lot of the default test validates methods to make asserts
- comment out the tests that fail for legitimate bugs
- logged the bugs
  - #43
  - #41
  - #40
- I also logged
#42 because I
wrote a test to assert the exception but I'm not actually sure if we
want that behavior or not

---------

Co-authored-by: Ken Payne <[email protected]>
@pnadolny13 pnadolny13 self-assigned this Jun 8, 2023
@pnadolny13 pnadolny13 moved this to In Progress in MeltanoLabs Overview Jun 8, 2023
pnadolny13 added a commit that referenced this issue Jun 8, 2023
Closes #40

The merge_from_stage and copy_from_stage accept a schema argument that
it uses to build a query that selects from the raw json files in the
stage using the json keys. Since the staging data is raw, we needed to
pass in the raw unconformed schema instead of the conformed schema. The
conformed schema converted the camelcase `Id` column to lower case `id`,
so the query it built was trying to select a key in the json file that
didnt exist. The query has lowercase and the file has camelcase.
@github-project-automation github-project-automation bot moved this to Planned in Data Team Jun 8, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in MeltanoLabs Overview Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant