N-Triples to MySQL

49 views
Skip to first unread message

Jeroen Steen

unread,
Nov 4, 2015, 4:17:35 AM11/4/15
to rdflib-dev
Hey, I'm trying to convert a N-Triples/.nt file to MySQL,
with rdflib, sqlalchemy and mysql.connector with Python.

This is my code:

from rdflib import Graph
import sqlalchemy


#1.0.9
print(sqlalchemy.__version__)


engine 
= sqlalchemy.create_engine('mysql+mysqlconnector://root:@localhost:3306/ksaat', pool_recycle=3600)
connection 
= engine.connect()
#<sqlalchemy.engine.base.Connection object at ..>
print(connection)


= Graph(engine, identifier="ksaat")
g
.open(connection, create=True)
g
.parse("input", format="nt")
g
.store()


#3110284
print(len(g))


I'm getting this error message:
No plugin registered for (Engine(mysql+mysqlconnector://root:***@localhost:3306/ksaat), <class 'rdflib.store.Store'>)


What can I do to make my code work?

I understood that I should use rdflib-sqlalchemy, but when I try to import it, it can't find it.
Reply all
Reply to author
Forward
0 new messages