Is python good for making database work short?

Steve stevesusenet at yahoo.com
Thu Jun 19 03:27:10 CEST 2003


Hi;

Today at work I got an impressive demonstration.

There was a database mess that had to be cleaned up fast.

One part of the problem involved copying tables from one database on
one server, to another database on another server.

To do it in Java would have been a bazillion lines of code.

I would have had to written code to:

1. connect to the parent database
2. a sql statement to get the data
3. intermediarly store the results
4. close the parent connection
5. open the connection to the child database
6. a sql statement with 50 column names to create a blank table
7. code to transfer the stored data into the new table
8. close the connection

A coworker who is a foxpro nut did all of this in about 3 lines of
code.

I was very impressed, and I plan to learn foxpro since the job has
legacy apps written in it.

However I was wondering if python could have made this job this easy. 
Does python make manipulating databases and data short work?

Part of the program we had to make also required doing many queries to
check the integrity of the data, and if it wasn't kosher, store the
bad data to a table for examination later.  In foxpro it was one line
of code to save the query into a table.  In java it would have been
another trek like the one I described above.

Java is great for a lot of stuff, but the jdbc is basically just a
pipe into the database to pass sql through with a lot of gymnastics to
get the sql into, massaged and out of the pipe.

Anyway, I would love to have an open source, multiplatform tool that
could match foxpro in ease of database manipulation.

Is python it?

Steve




More information about the Python-list mailing list