RdbHost

Object Relational Mappers (ORMs)

ORMs provide a way to manipulate SQL databases without SQL; The ORM model used Python data structures (classes and instances) to hold the data, and the necessary SQL to store and retrieve the data is generated behind the scenes.

The two best-known ORMs in Python are SQLAlchemy and SQLObject. If you wish to use either of these to query your RdbHost database, we provide the necessary interface modules.

SQLAlchemy

You need SQLAlchemy and Rdbhdb installed, and this database module. Put this file in your lib/sqlalchemy/databases folder, and SqlAlchemy will find it.

The connect string is like : rdbhost://role:authcode@www.rdbhost.com . The rolename and authcode are from your profile page, after you create an account here on www.rdbhost.com. Creating an engine for SqlAlchemy is done with code like:

role = 's0000000849' authcode = 'abc123~~~~~~~789xyz' engine = create_engine('rdbhost://'+role+':'+authcode+'@www.rdbhost.com')

If you wish to run the SqlAlchemy test suite against an Rdbhost database, you should also download these test files (two directories) and place them in the corresponding directories of your SqlAlchemy installation. They have disabled the few tests that are not expected to pass.

SQLObject

You need SQLObject and Rdbhdb installed.

Possibly, SQLObject will already have Rdbhost support by the time you read this. If not, please do the following:

  • Create a new folder 'rdbhost' in the SQLObject package, in the same directory with 'postgresql' and 'mssql' folders.
  • Add two new files, '__init__.py' and 'rdbconnection.py', available here, to that folder.
  • Also replace the files 'conftest.py', 'converters.py', 'dbconnection.py', and 'sqlbuilder.py', available here.

The connect string is like : rdbhost://role:authcode@www.rdbhost.com . The rolename and authcode are from your profile page, after you create an account here on www.rdbhost.com. Creating an engine for SqlObject is done with code like:

role = 's0000000849' authcode = 'abc123~~~~~~~789xyz' sqlhub.processConnection = \ connectionForURI('rdbhost://'+role+':'+authcode+'@www.rdbhost.com')

If you wish to run the SqlObject test suite against an Rdbhost database, you should also download these test files and place them in the 'tests' folder of your SqlObject installation. They have disabled a few tests that are not expected to pass.