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

ToxBatch duplicates check doesnt work #1

Closed
r7butler opened this issue Sep 2, 2022 · 1 comment
Closed

ToxBatch duplicates check doesnt work #1

r7butler opened this issue Sep 2, 2022 · 1 comment

Comments

@r7butler
Copy link
Contributor

r7butler commented Sep 2, 2022

For some reason, the checkDuplicatesInProduction check for ToxBatch is not catching errors, if the submission contains records already in the database
tox_demo.xlsx

@r7butler
Copy link
Contributor Author

r7butler commented Sep 2, 2022

The reason it didnt work is because apparently the table was renamed, but the constraint was not renamed. This is obviously a major flaw with the application which must be changed in the original template repository

The issue was with the get_primary_key function in core. i had to adjust the query to get the primary key according to the answer on this stack overflow post

I had to adjust the query to this
SELECT
c.column_name,
c.data_type
FROM information_schema.table_constraints tc
JOIN information_schema.constraint_column_usage AS ccu USING (constraint_schema, constraint_name)
JOIN information_schema.columns AS c ON c.table_schema = tc.constraint_schema
AND tc.table_name = c.table_name AND ccu.column_name = c.column_name
WHERE constraint_type = 'PRIMARY KEY' and tc.table_name = '{tablename}';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant