I am trying to fetch a date from sqlserver2008 convert it into milliseconds and use it in my code. This is my code
cursor.execute("select min (d.Date) from (select ProdID as brand ,max(Datekey) as Dt from SocMet_Daily_Fact where ProvID=5 group by ProdId) a left join dimdate d on a.Dt =d.DateKey")
from_date=cursor.fetchone()
print "printing from_date type"
print str(type(from_date))
from_date=parser.parse(from_date)
print from_date
from_sec=time.mktime(datetime.datetime.strptime(from_date, "%Y-%m-%d H:%M:%S").timetuple())
from_sec=int(from_sec*1000)
print from_sec
I get this response/error.
printing from_date type
<type 'pyodbc.Row'>
'pyodbc.Row' object has no attribute 'read'
Is my parsing correct?Is this the correct type of parsing to convert a DB row object into a date type object?
Note that in the database the row is in this format
2014-07-01 00:00:00.000