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

Error with MySQL database name having a dash #84

Closed arenas-guerrero-julian closed 2 years ago

arenas-guerrero-julian commented 2 years ago

Hi!

I get an error running with the latest version of SDM-RDFizer wunning over MySQL due to the database name containing a dash (gtfs-sql). If I rename the database to gtfs it works. Below it is the error.

Julián

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/julian/GitHub/atomic-rml/venv/lib/python3.8/site-packages/rdfizer/__main__.py", line 49, in <module>
    main()
  File "/home/julian/GitHub/atomic-rml/venv/lib/python3.8/site-packages/rdfizer/__main__.py", line 45, in main
    semantify(config_path)
  File "/home/julian/GitHub/atomic-rml/venv/lib/python3.8/site-packages/rdfizer/__init__.py", line 4829, in semantify
    cursor.execute("use " + config[dataset_i]["db"])
  File "/home/julian/GitHub/atomic-rml/venv/lib/python3.8/site-packages/mysql/connector/cursor_cext.py", line 264, in execute
    result = self._cnx.cmd_query(stmt, raw=self._raw,
  File "/home/julian/GitHub/atomic-rml/venv/lib/python3.8/site-packages/mysql/connector/connection_cext.py", line 508, in cmd_query
    raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-sql' at line 1
eiglesias34 commented 2 years ago

Hello @ArenasGuerreroJulian,

I check the error and determined that the error is not with the SDM-RDFizer but with the query syntax. I ran a similar query through a SQL syntax checker and returned the same error. This means that the table name cannot have "-". Possible alternatives use the table's name with quotes or escape the character. If these options are not possible, the table's name has to be changed.

Sincerely, Enrique

arenas-guerrero-julian commented 2 years ago

Thank you @eiglesias34 !