I am trying a simple CSV file import with pystardog/Python, but am stuck with stardog.exceptions.StardogException: [415].
import stardog
connection_details = {
'endpoint': 'myURLtoStardog',
'username': 'myusername',
'password': 'myuserpwd',
'database': 'mystardogdbname'
}
# Connect to DB
with stardog.Connection(**connection_details) as connection:
connection.begin()
# import CSV file using a SMS2 mapping file
connection.add(stardog.content.ImportFile('cars.csv'))
connection.add(stardog.content.MappingFile('cars_mappings.sms'))
connection.commit()
I am using the official Stardog example csv files. I am following the syntax/examples described in the pystardog documentation. But I end up with below error.
Has anyone an idea what I am doing wrong? Or is my assumption incorrect that I can use pystardog to do the same csv import as with the Stardog CLI?
Traceback (most recent call last):
File "C:\Users\me\stardog_import-csv.py", line 16, in <module>
connection.add(stardog.content.ImportFile('cars.csv'))
File "C:\Users\me\AppData\Roaming\Python\Python39\site-packages\stardog\connection.py", line 165, in add
self.client.post("/{}/add".format(self.transaction), **args)
File "C:\Users\me\AppData\Roaming\Python\Python39\site-packages\stardog\http\client.py", line 49, in post
return self.__wrap(self.session.post(self.url + path, **kwargs))
File "C:\Users\me\AppData\Roaming\Python\Python39\site-packages\stardog\http\client.py", line 71, in __wrap
raise exceptions.StardogException(
stardog.exceptions.StardogException: [415] :