[BioSQL-l] Python ORM mapping for BioSQL
Peter
biopython at maubp.freeserve.co.uk
Wed Nov 26 18:37:51 UTC 2008
On Tue, Nov 25, 2008 at 9:16 PM, Brad Chapman <chapmanb at 50mail.com> wrote:
> 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.
I've been using TurboGears with SQLAlchemy, and so far everything has
been OK. This was essentially independent of the Biopython BioSQL
mapping.
> 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.
Yes, SQLAlchemy seems pretty good. The only catch was for a table
with no primary key defined at all (the taxon_name table) which
required a little more work setting up the ORM mapping, but which also
seems to work fine.
> 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
>
I'll probably take a look at this next week - I'm on the road at the
moment. Thanks for sharing,
Peter
More information about the BioSQL-l
mailing list