Luke Maurits
unread,Jan 21, 2013, 11:03:48 PM1/21/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to prettyta...@googlegroups.com
Greetings prettytable-devel,
It's that magical time of the year again, where I finally get around to
releasing a new PrettyTable so that all of the improvements and fixes
which have accumulated in trunk over the last several months can finally
see the light of day.
Tonight I tagged 0.7-RC01, the first release candidate for PrettyTable
0.7. I would like to request that anybody with the time and
inclination give the new version a test and let me know if
they experience any problems.
There are a few new features in particular that I would like people to
make use of if it's convenient for them.
1. IMPORTING FROM CSV
If you have your table data in a comma separated values file (.csv),
you can read this data into a PrettyTable like this:
from prettytable import from_csv
fp = open("myfile.csv", "r")
mytable = from_csv(fp)
fp.close()
2. IMPORTING FROM DATABASE
If you have your table data in a database which you can access using a
library which confirms to the Python DB-API (e.g. an SQLite database
accessible using the sqlite module), then you can build a PrettyTable
using a cursor object, like this:
import sqlite3
from prettytable import from_cursor
connection = sqlite3.connect("mydb.db")
cursor = connection.cursor()
cursor.execute("SELECT field1, field2, field3 FROM my_table")
mytable = from_cursor(cursor)
3. USING NON-LATIN CHARACTERS
Previous versions of PrettyTable have not handled non-Latin character
sets well (e.g. text in Chinese, Japanese, Korean, Russian, etc.).
Many of these characters have len() = 1 or 2 according to Python's
inbuilt string methods, but take up 2 or 1 spaces in the terminal.
This lead to tables which were poorly aligned. Completely fixing this
for any and all languages is a huge undertaking, but I hope I have
brought PrettyTable a good chunk of the way toward handling some of the
most common scenarios. So if you are using PrettyTable in an
application that involves data in languages which do not use Latin
characters, please check that alignment etc. works correctly for your
language.
There are a few other less major changes which you can read about in
the CHANGELOG file.
Even if you are unable to easily test any of the above new features,
just testing 0.7 in your current applications to make sure I have not
broken anything which worked previously would be very much
appreciated. There should not have been any breaking of syntax
compatibility between 0.6 and 0.7, so hopefully this kind of minimal
testing should be able to be done quickly and easily.
I would like to make the release sometime in the next few days before I
lose time or interest and the next release gets held up yet again, so
the sooner people are able to offer feedback, the better.
As always, many thanks to everybody who reported bugs, made good
feature requests or contributed patches.
Cheers,
Luke