Value of an unknown object returned from odbc

Sabine Richter sabine at textraeume.de
Wed May 15 09:55:10 EDT 2002


Hello,

it was not so easy to describe the subject.
My environment is:
Win XP Prof, Python 2.2.1, Win32all-146, MySQL 2.23.49 and MyODBC
3.51.02.

My problem is:

I want to dump a MySQL-database. So first I fetch the structure of a
table and then the content.
In some cases I get not the value, but the memory address or the value,
but not the desired data type.

For example:

Structure of the table:

CREATE TABLE `dmversion` (
  `version` float NOT NULL default '0',
  `vuser` char(16) NOT NULL default '',
  `vdate` datetime NOT NULL default '0000-00-00 00:00:00'
) TYPE=MyISAM;

So far it is ok.

But when I ask for the content, I get for the first row:
(1L, 'Sabine', <DbiDate object at 0x00ACA370>)

So I have to:
-convert the first value to a float
-get the value of the DbiDate object


My questions are:
-Is it expected, that I get, what I got? Or is it a bug? And if it is a
bug, which part is to be blamed?

-Is there an easy way to get the desired values?

I can compare types:
from types import *
for t in range(len(a)):
    b=a[t]
    if type(b)==LongType:
        b=float(b)
    elif type(b)== ????????????  --> DbiDate Object:
        get the value of DbiDate Object


But:
I don't know which types I can get.
So it is a long, long if elif elif elif else errorhandling.
That's not nice.

And:
How can I compare the type DbiDate object?
And how can I get the value?

Sorry that my mail is so long and for my bad english.

And thanks for your answers

Sabine





More information about the Python-list mailing list