dbi datetime type comparison

jwsacksteder at ramprecision.com jwsacksteder at ramprecision.com
Thu May 29 08:55:23 EDT 2003


I'm working on a project where I extract data from one database and insert
it 
into another. I have created functions to scrub the individual fields in 
various ways depending on the field type. I pull in the entire result set, 
then  iterate over each row and column in turn I want to call the correct 
function for each type as it is found. The problem is that dbi.date is not a

type, but an object. 

How can identify dbidatetime elements in a list?

This works for string types...

	for item in row:
		if type(item) is StringType:
			print "String "
		else: 
			print "Not String "

By analogy, I want this...

	for item in row:
		if type(item) is DbiDate:
			print "Date "
		else: 
			print "Not Date "

...but obviously, that doesn't work.











More information about the Python-list mailing list