2005-04-14

While waiting for new version of Jython

I had the need for automatically creating tables from comma separated files, and thought of using Jython as the tool. Since the released version of Jython is based on Python 2.1, there are many features in newer versions of Python which are lacking in Jython. The Python module I was going to look at was the csv module, which is handy when working with comma separated files.

A little bit of background. I'm using a 'free' version of DBVisualizer, which is part of BEA WebLogic Platform. I needed to create a local database on a few of the tables from an ERP system and the free version of DBVisualizer only supports exporting a table definition as a comma separated file or HTML. DDL export would have been nice.

Since I got sick yesterday I decided - in boredom - to create a script reading these csv files (why are they called csv when they should have been called csf) and then create the tables in MySQL. I found the csv module, but since this module isn't part of Jython I had to use Python. The script might not be the prettiest thing, but it does the job and the tables are created within a second.

I'm really hoping that Jython gets it momentum up and running. According to the roadmap the first release will be in August and there's an indication that some of the new modules included (such as the csv module) might not be released until November....

Now I probably try looking at DBUnit to populate the database with some data.... I probably could have used Python also here, but there's nothing like trying out a new tool when struggling with a cold.

7 comments:

Anonymous said...

CSV stands for Comma Separated Values. It's tha values that are separated by commas and not the F(ile) :).

André M. Bonkowski said...

He he... nice comment!

Anonymous said...

you can populate the data directly with Jython if you have a JDBC driver for it. I am doing it all the time for our load test.

Victor

Trond Andersen said...

Populating the database isn't the problem. The issue is that Jython doesn't have updated Python modules so for modules that have been adding after 2.1 - isn't available in Jython. In this case I'm missing the csv module.

Anonymous said...

Great article! Thanks.

Anonymous said...

Thanks for interesting article.

Anonymous said...

Excellent website. Good work. Very useful. I will bookmark!