Little direction please Python MySQL

Steve Holden steve at holdenweb.com
Thu Nov 13 17:00:30 EST 2008


len wrote:
> 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.
> 
> Could someone recommend either books, website, or free package whose
> code I could look at to move from the student type programs to gee I
> work in the real world now programs.
> 
There may be some usable ideas in

  http://holdenweb.com/PyConTX2007/dbPythonIntro.pdf

though it sounds like you might have already come across most of them.
It's mostly just a matter of packaging things in a usable way so you can
write simple code. For example

    order.sales_amount += ordlin.sales_qty * ordlin.sales_price

By all means post specific questions when the code starts to get tacky
or when you can't see your way through to a solution. People on this
list are usually incredibly helpful.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list