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

Type mismatch from Julia #4

Closed
hhoeschle opened this issue Jun 17, 2019 · 5 comments
Closed

Type mismatch from Julia #4

hhoeschle opened this issue Jun 17, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@hhoeschle
Copy link

hhoeschle commented Jun 17, 2019

Hey,

we call the spinedb_api from Julia in the following way:

@show id_list = [Int16(db_map.get_or_add_object_class(name=obj_class)[1]) for obj_class in object_classes]
@show typeof(id_list)
@show relationship_class = db_map.add_wide_relationship_class(name = relationship_name, object_class_id_list=id_list)

Unfortunately, when submitting the id_list to python it is translated in a numpy.int64 rather than an int. This leads to the problem that the relationship is not correctly created, as the object_class_id in the sql-db is stored as BLOB.

Would it be possible to integrate the following explicit typecast:

            for wide_kwargs in wide_kwargs_list:
                for dimension, object_class_id in enumerate(wide_kwargs["object_class_id_list"]):
                    narrow_kwargs = {
                        "id": id,
                        "dimension": dimension,
                        "object_class_id": int(object_class_id),
                        "name": wide_kwargs["name"],
                    }
                    item_list.append(narrow_kwargs)

I guess it may also occur at other places. I will collect and report them below.

Thanks
Hanspeter

Link to file

@hhoeschle
Copy link
Author

hhoeschle commented Jun 20, 2019

Also

"object_id": int(object_id)

Link to file

@manuelma
Copy link
Collaborator

perhaps we should cast all ids to int...

@manuelma
Copy link
Collaborator

Have you checked if PyCall says anything about this ?

@hhoeschle
Copy link
Author

The casting is done here

I guess somehow PyLong_FromLongLong maps onto numpy.int64 ... but it is hard to conclude

@KristofPhillips95 KristofPhillips95 added the bug Something isn't working label Sep 14, 2021
@jkiviluo
Copy link
Member

Must be an outdated issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants