Little direction please Python MySQL

len lsumnler at gmail.com
Fri Nov 14 23:21:17 EST 2008


On Nov 13, 7:32 pm, Ethan Furman <et... at stoneleaf.us> wrote:
> len wrote:
> > Hi all;
>
> [snip]
>
> > 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.
>
> [snip]
>
> > Thanks Len
>
> I've never had the (mis?)fortune to work with COBOL -- what are the
> files like?  Fixed format, or something like a dBase III style?  I
> presume also that you only need access to them in COBOL format long
> enough to transfer them into MySQL -- true?
>
> ~ethan~

Files are fixed format no field delimiters, fields are position and
length
records are terminated by newline.  In cobol the read statement which
read
a record from the file automaticly mapped the date to the fieldnames
in
the cobol file definition.

In python you as the programmer have to do the mapping of data to
fieldnames
whether this is using list and numeric indexing (list[n]),
dictionaries
file['fieldname'] = value or attribute (self.fieldname = value through
some class).
Now in my case I literally have a couple of hundred files and each
file may have
20 or 30 fieldnames and in several cases 100 to 150 fields (customer
file alone
has 98).  So as you can imagine standardize the mapping is a big deal
to me.

Now all of the sample code you find (understandably) usually shows SQL
code
and python code manipulating 3 or 4 fields at the most and one 1 or 2
tables
at a time.  In the real world I have programs that will need to work
on 5, 10, and
15 files at a time and 100's of fields.  Basicly it is the difference
between
writing your jave, C++, or python program to complete your programming
language
assignment for your college class and then graduating and getting a
job and being
told to write the companies new CRM or ERP system.  You can find
plenty of beginning
tutorial and code snippets or esotiric code using stuff for landing
the lunar lander
but where is the middle ground.

That is the stuff I'm looking for.

Please understand this is not a rant against SQL or python or their
communities
but at my own progress in these to become a competent programmer and
I'm sure
as every programmer in the world has experienced, it just never occurs
fast
enough.

Len



More information about the Python-list mailing list