SDM-TIB / SDM-RDFizer

An Efficient RML-Compliant Engine for Knowledge Graph Construction
https://doi.org/10.5281/zenodo.3872103
Apache License 2.0
107 stars 25 forks source link

Crash when joins are involved with PostgreSQL #90

Closed DylanVanAssche closed 1 year ago

DylanVanAssche commented 1 year ago

Describe the bug

translate_postgresql function does something weird when creating the query for PostgreSQL, it tries to concat a list to a string. Python does not like that and errors out with:

Semantifying out...
CRASH:
['id']
---------------
Traceback (most recent call last):
File "//sdm-rdfizer/rdfizer/run_rdfizer.py", line 3, in <module>
semantify(str(sys.argv[1]))
File "/sdm-rdfizer/rdfizer/rdfizer/semantify.py", line 5005, in semantify
database, query_list = translate_postgressql(triples_map)
File "/sdm-rdfizer/rdfizer/rdfizer/semantify.py", line 4661, in translate_postgressql
temp_query += "\"" + p + "\""
TypeError: can only concatenate str (not "list") to str
Semantifying out...
CRASH:
['id']
---------------
Traceback (most recent call last):
File "//sdm-rdfizer/rdfizer/run_rdfizer.py", line 3, in <module>
semantify(str(sys.argv[1]))
File "/sdm-rdfizer/rdfizer/rdfizer/semantify.py", line 5005, in semantify
database, query_list = translate_postgressql(triples_map)
File "/sdm-rdfizer/rdfizer/rdfizer/semantify.py", line 4661, in translate_postgressql
temp_query += "\"" + p + "\""
TypeError: can only concatenate str (not "list") to str

I tried to debug it by adding some changes and print statements, but that didn't help: https://github.com/DylanVanAssche/SDM-RDFizer/commit/5072660c35a404ef7774e29dfa2ed44d91adaf54

Somewhere in the code a list is created of the column id but I have no clue where.

To Reproduce Steps to reproduce the behavior (and resources):

  1. Run a mapping with joins on PostgreSQL
  2. crash

Expected behavior

No crashes when using joins and PostgreSQL.

Desktop (please complete the following information):

Additional context Upgrading to 4.6.1 is not possible because of personal reasons.

eiglesias34 commented 1 year ago

Hi @DylanVanAssche,

I hope this message finds you well. I found the issue with the join and fixed it. The corrected code is present in version 4.6.2 of the SDM-RDFizer. I hope this solves your problem.

Sincerely, Enrique

DylanVanAssche commented 1 year ago

Hi @eiglesias34 ,

The fix seems to work, but PostgreSQL is broken in that release. The client library was not imported anymore, fix in https://github.com/SDM-TIB/SDM-RDFizer/pull/91

Are there any plans for some tests to avoid this in the future? Thanks!

eiglesias34 commented 1 year ago

Hi @DylanVanAssche,

I apologize for this oversight. When I made the new release, I was helping a college with the RDFizer. She was having trouble with the Postgres library (in Windows), so I tested it out if it could run without that library for cases that don't use Postgres. Unfortunately, I didn't notice that uploaded the version in which I did this test. I usually do multiple tests before uploading a new version; in this case, things got mixed up by mistake. I apologize again.

I hope you continue using the SDM-RDFizer.

Sincerely, Enrique

DylanVanAssche commented 1 year ago

Hi @eiglesias34 ,

Oh no problem :) This stuff can happen, no need to worry about that :) I was just wondering if those tests cannot be done with Github Actions or something, that would make your life easier :)