[BioSQL-l] Python ORM mapping for BioSQL

Brad Chapman chapmanb at 50mail.com
Tue Nov 25 21:16:22 UTC 2008


Hi Peter;
Hope all is going well with you. I was glancing at the BioSQL
mailing list archives last night and saw your messages earlier this
month about using an ORM mapper with BioSQL.

Some of my current work is using a BioSQL storage backend with a
javascript web interface. The middleware uses Pylons and SQLAlchemy.
This uses some parts of BioSQL not well represented via an object front
end like bioentry_relationship, and so it has been convenient to work
with these via SQLAlchemy directly.

To your initial question, SQLAlchemy can handle those non-primary key
tables without a problem by setting "primary_key = True" for all of
the unique columns.

What I have done thus far is definitely non-complete, and also
includes some add-on tables for storing experimental data linked to
BioSQL. However, I am attaching it here just to give you an idea
(init.py is the __init__.py of the module). You would use it like:

from Wherever.BioSQL import get_session, biosql

session = get_session("production")
entries = session.query(biosql.Bioentry).filter_by(identifier = "A12345")

If you, or anyone else, is developing something similar,
I'd be happy to help with something generalized.

Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.py
Type: text/x-python
Size: 1116 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biosql-l/attachments/20081125/f4daa3a6/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BioSQL.py
Type: text/x-python
Size: 6881 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biosql-l/attachments/20081125/f4daa3a6/attachment-0001.py>


More information about the BioSQL-l mailing list