EHDEN/ETL-UK-Biobank

Baseline to stem value too long for value_as_string varying(50)

Closed this issue · 0 comments

We have to truncate the input for the value_as_string and value_source_value field to 50 characters.

sqlalchemy.exc.DataError: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(60)

[SQL: INSERT INTO omopcdm.stem_table (person_id, concept_id, start_date, start_datetime, type_concept_id, value_as_string, visit_occurrence_id, source_value, data_source) VALUES (%(person_id)s, %(concept_id)s, %(start_date)s, %(start_datetime)s, %(type_concept_id)s, %(value_as_string)s, %(visit_occurrence_id)s, %(source_value)s, %(data_source)s) RETURNING omopcdm.stem_table.id]
[parameters: {'person_id': '1000071', 'concept_id': 0, 'start_date': datetime.date(2009, 2, 19), 'start_datetime': datetime.datetime(2009, 2, 19, 0, 0), 'type_concept_id': '32817', 'value_as_string': 'Ia) Cardiac Arrest;Ib) Myocardial Infarction;II) Metastatic Renal Carcinoma (Spinal Metastasis), Four Level Vertebrae Resection, Dural Resection with Dural Patch Bilateral Thoracotomies - all for Tumour Resection.', 'visit_occurrence_id': '1100007100000000', 'source_value': '40010', 'data_source': 'baseline'}]