Little direction please Python MySQL

len lsumnler at gmail.com
Fri Nov 14 23:25:39 EST 2008


On Nov 14, 4:19 am, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> len a écrit :
>
>
>
>
>
> > Hi all;
>
> > I am looking for a little direction in moving from novice python MySQL
> > to real world processing.
>
> > I can connect to MySQL databases and have performed most of the
> > various select, create, update, insert, etc given the examples in the
> > various books and internet tutorials not to many problems.
>
> > Here is my problem.  I need to start doing this in the really world at
> > my company converting some older cobol system and data to python
> > programs and MySQL.  I have gotten past packed decimal fields and
> > various other little tidbits.  My problem is the data files aren't
> > little three of four field files but Customer File with 98 fields
> > etc.  I understand building dictionaries and building with zip and I
> > have even seen a reference to using __setattr__ in an empty class but
> > I'm having a hard time moving past the little code snippts to real
> > code.
>
> > As you can image the data coming from old cobol files fieldname are
> > generally very large and tons of code that might start looking like;
>
> >      order['ordhdr_sales_amount'] += order['ordlin_sales_qty'] * order
> > ['ordlin_sales_price']
>
> > could start becoming quite cumbersum.
>
> > I'm sure that there is someway to make all of this less verbose using
> > classes and such but I need some direction.
>
> You may want to have a look at SQLAlchemy. It will require some
> additional learning, but chances are you'll waste less time than trying
> to roll your own half-backed ORM-like system.
>
> My 2 cents...

I haved looked at SQLAlchemy and will start using it.  I do feel that
I need to hand code a few things just to get and understanding of
whats involved.  I find that this usually making the package a little
easier to use and generally makes me a better user of the package or
at least it has in the past.

Len



More information about the Python-list mailing list