Skip to main content


Project description

PyRDB2RDF provides RDFLib with an interface to relational databases as RDF stores. The underlying data is accessed via SQLAlchemy. It is mapped to RDF according to the specifications of RDB2RDF. The corresponding RDF graph is represented as an RDFLib graph.

Translating from relational data to RDF via direct mapping is currently supported. Translating in the other direction and mapping with R2RML are planned but not yet implemented.


pip install rdb2rdf


Serializing a database as N-Triples

Suppose the local PostgreSQL database test_dm contains data that we want to translate to RDF and serialize as N-Triples. The following code achieves that.

import rdflib as _rdf
import sqlalchemy as _sqla

db_str = 'postgresql://testuser:testpasswd@localhost/testdb'
db = _sqla.create_engine(db_str)
graph = _rdf.Graph('rdb2rdf_dm')




  • Updated references to Spruce projects (lang, iri, types) and Goose Types.
  • Improved the setup script.
  • Improved documentation.


  • Added a missing installation dependency.


First public release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rdb2rdf, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size rdb2rdf-0.1.3.tar.gz (29.9 kB) File type Source Python version None Upload date Hashes View
Filename, size rdb2rdf-0.1.3-py2.7.egg (16.7 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size rdb2rdf-0.1.3-py2-none-any.whl (21.4 kB) File type Wheel Python version 2.7 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page