added support for specifying a query rather than simply a table name to
allow for additional customization as required; removed the rownum attribute
from the rows since it serves no useful purpose; use cx_Logging rather than
printing directly to sys.stderr. Thanks to Micah Friesen for the initial patch.