gbook / nidb

NeuroInformatics Database
GNU General Public License v3.0
26 stars 8 forks source link

Field 'series_protocol' doesn't have a default value #111

Closed andersonwinkler closed 2 years ago

andersonwinkler commented 2 years ago

Hey Greg,

Please see below:

[2022/07/01 16:46:04][3689226] SQL ERROR (Module: import Function: InsertDICOMSeries File: ../../../SOURCES/src/nidb/moduleImport.cpp Line: 1613)

SQL [insert into sr_series (study_id, series_datetime, series_desc, series_num, series_createdby) values (9207, 2022-06-16 15:54:16, Phoenix Document, 99, 'import')]

Database error [Field 'series_protocol' doesn't have a default value]

Driver error [QMYSQL3: Unable to execute statement]
[2022/07/01 16:46:04][3689226] SQL error, exiting program

We used to import only scans from a GE scanner, but now importing from a Siemens Terra. I think I know what the issue is and how to fix but your solution is likely going to be better, faster...

Thanks!

Cheers,

Anderson

andersonwinkler commented 2 years ago

Btw, after removing the Siemens files from the dicomincoming directory, it now says:

NiDB version 2020.7.541   Build date [Jul 22 2020 16:55:09]   C++ [201703]   Qt compiled [5.12.8]   Qt runtime [5.12.8]   Build system [x86_64-little_endian-lp64]
[2022/07/13 10:30:01][2995080] Entering the import module
[2022/07/13 10:30:01][2995080] ********** Working on directory [/nidb/data/dicomincoming] with importRowID [0] **********

and gets stuck...

gbook commented 2 years ago

Hi Anderson,

As the mariadb gets upgraded, sometimes the global requirement of having a default value (or lack thereof) can change. In phpMyAdmin, edit the schema for the mr_series table. Change the default value to null for the series_protocol column. If you run the import module again, it may find other columns that also do not have default values. It is probably worth it to change the default values to null for all of the columns in the mr_series table.

Another thing you can look at is the error_log table. It records all SQL errors, even if they aren't displayed on a website or in a log file.

andersonwinkler commented 2 years ago

Great, thanks, I'll do that.

The second error could be just because the backlog is now too big (~600k files). I've moved all to another directory and moving back in batches of 50k. The error disappeared then.

Thanks again, super helpful as always!

Anderson