Larry Bates wrote:
[EMAIL PROTECTED] wrote:
I have a machine (PLC) that is dumping its test results into a fixed-
length text file.  I need to pull this data into a database (MySQL
most likely) so that I can access it with Crystal Reports to create
daily reports for my engineers.
[..]
I need to know how to write a script that will DAILY pull this text
file into a MySQL database.

Just use the built in import SQL statement to import the information. You don't really need a Python script. import can handle fixed field records (as well as CSV, etc.).

If the input data has to be pre-processed before storing it into the database a Python script would be needed.

Just in case somebody needs a module for reading fixed-length files in the spirit of module csv:

  http://www.stroeder.com/pylib/fixedlenfields.py

For the MySQL part:
http://mysql-python.sourceforge.net/

Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to