[FRPythoneers] Object-relational mapper for Python and MySQL?

Ken Goodhew kgoodhew at yahoo.com
Wed Feb 25 17:27:53 MST 2009


Vince,
My group looked at Django a little, but it seemed better suited to writing a web app, that just happens to have a database back-end.
I would highly recommend SqlAlchemy.  We've been using it heavily for the last 7 months with a fairly large Oracle database, and I'm extremely impressed.
It's a bit of a learning curve, but it will do all the things you list below, including extracting the data model and joining tables (I haven't tried outer_join yet, but it's supported).
The online docs are good, and there's a good suite of tests and examples with the source code but I recommend the O'Reilly book.  The user group is active.  I reported a bug, and the maintainer fixed it the same day.

Let me know if you have questions.  I'll be happy to help you get started.
Good Luck.

Ken Goodhew
Director of Development
Boulder Securities.



----- Original Message ----
From: Vince Dean <vdean at ucar.edu>
To: Front Range Python Users -- General Discussion <frpythoneers at lists.community.tummy.com>
Sent: Wednesday, February 25, 2009 3:13:14 PM
Subject: [FRPythoneers] Object-relational mapper for Python and MySQL?

I'd appreciate suggestions for Python tools to simplify queries
against a MySQL database.

I am writing a number of reports in Python against a MySQL
database, using MySQLdb.  Not surprisingly, I'm writing a
lot of boilerplate Python and SQL.

I know that there are a number of Python modules to support
this sort of work (SQLAlchemy, SQLOject, Django, etc.), and
I'd welcome thoughts on which might be my best fit.  Here is
our situation.

* I'm doing queries only; the data is maintained by another
(Java) application.

* Efficiency is not a big issue.  The system has few users
and the reports are run infrequently.  Ease of development is
a bigger concern.

* The database already exists; I cannot change column or table
names to conform to a convention.

* It's not a small database.  We have 123 tables and 770
columns, but I am writing queries against a relatively small
fraction of them.

* Queries frequently involve four or more tables.  Some of
the logic is easily handled by SQL joins; other parts require
program logic to navigate through the relationships.

* It would be useful, but not essential, if the tool could
extract some of the data model it needs directly from the
database schema.

* I just need a tool to help with the database queries and return
the results to Python, for some pretty simple text reports.
I'm not building a Web application.

Any thoughts?

Thanks,
Vince


_______________________________________________
This message sent by the FRPythoneers mailing list.
Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers



      



More information about the FRPythoneers mailing list