aiida-core
aiida-core copied to clipboard
Importing archive in `core.sqlite_dos` fails
If the archive contains a Computer
, the import will fail with:
Traceback (most recent call last):
File "/home/sph/.mambaforge/envs/aiida-py311/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1805, in _execute_context
context = constructor(
^^^^^^^^^^^^
File "/home/sph/.mambaforge/envs/aiida-py311/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 1457, in _init_compiled
l_param: List[Any] = [
^
File "/home/sph/.mambaforge/envs/aiida-py311/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 1459, in <listcomp>
flattened_processors[key](compiled_params[key])
File "/home/sph/.mambaforge/envs/aiida-py311/lib/python3.11/site-packages/sqlalchemy/sql/sqltypes.py", line 3590, in process
value = value.hex
^^^^^^^^^
AttributeError: 'str' object has no attribute 'hex'
It seems like this has to do with the UUID of the Computer
instance. Sqlalchemy thinks it is a UUID
type and so calls .hex
on it, but actually the value is a string. The core.psql_dos
models do have the uuid column as a native UUID type, however Sqlite doesn't support that, so when the models are derived from the core.psql_dos
backend, the UUID column is converted to CHAR(32)
. It is not quite clear why sqlalchemy still converts the uuid to a UUID type.