On Tuesday 13 October 2009 12:21:10 pm Adrian Klaver wrote: > On Tuesday 13 October 2009 12:09:55 pm John wrote: > > On Tuesday 13 October 2009 11:40:58 am Paul McNett wrote: > > > John wrote: > > > > Hi, > > > > Maybe this old hat for others but I have run into a strange > > > > difference between Linux and Windows when selecting data from a > > > > "dataset" as in newdata = sessds.execute("select sessionid, miles, > > > > facility,began,ended,totalseats from dataset group by 1 order by 2") > > > > > > > > In the above select statement "began" and "ended" are suppose to be > > > > dates. They are using the "date" type in the Postgres database. > > > > > > > > On Linux the values are returned as > > > > 'began': datetime.date(2009, 10, 3), 'ended': datetime.date(2009) > > > > which is what I would have expected. > > > > > > > > However, on Windows the values are returned as > > > > 'began': u'2009-10-03', 'ended': u'2009-10-04' > > > > which is not what I'd expect. > > > > > > > > Was there a setting or some other thing I was suppose to do for dates > > > > in datasets for windows? > > > > > > Same database? Same python version? Same pspypg (or whatever the hell > > > it is called) version? In the dataset you are selecting from, are the > > > values dates on both platforms? > > > > > > Paul > > > > I get the get dataset as follows: > > sessds = tempCursor.getDataSet() > > sessds[0] shows the dates as > > began': datetime.date(2009, 10, 3), 'ended': datetime.date(2009) > > > > The Postgres (8.3.7) database is the same for both windows and Linux. > > Linux: > > python 2.5.2 > > wxPthon 2.8.10.1 > > Dabo latest SVN > > sqlite3 - 2.3.2 > > psycopg2 - 2.0.11 > > > > Windows: > > python 2.5.4 > > wxPython 2.8.10.1 > > Dabo latest SVN > > sqlite3 - 2.3.2 > > psycopg2 - 2.0.11 > > > > The only diff I see is python versions. > > > > I have created a workaround but I think there has to be some other > > problem I don't see. > > > > below is the code I'm using: > > > > tempCursor = self.MainForm.PrimaryBizobj.getTempCursor() > > csql = """Select > > round(miles_between_lat_long(l.latitude::numeric, l.longitude::numeric, > > c.latitude::numeric, c.longitude::numeric),0) as miles, s.began, s.ended, > > s.pkid as sessionid,s.total_hours,l.facility, cl.pkid as classid, > > cl.schedule as classdate, to_char(cl.schedule,'Day') as theweekday, > > l.totalseats, > > (select count(*) from esattend where classid = cl.pkid) as sched_students > > from essess s > > join esloc l on l.pkid = s.locationid > > join esclient c on c.pkid = 23089 > > left join esclass cl on cl.sessionid = s.pkid > > where s.topic = 43 and cl.cancelled = False and cl.fk_rescheduled_class = > > 0 and cl.schedule >= date(now()) -90 order by 1""" > > > > tempCursor.execute(csql) > > sessds = tempCursor.getDataSet() > > classds = tempCursor.getDataSet() > > #get only the sessions > > self.theTree.root = self.theTree.AddRoot('Sessions') > > > > newdata = sessds.execute("select sessionid, miles, > > facility,began,ended,totalseats from dataset group by 1 order by 2") > > > > Larry tells me he is getting the same string from the selection from a > > dataset. > > Johnf > > Importing sqlite3 into Python(2.5.2) shell and running help(sqlite3) gets > me the following at the bottom of the help. > > adapters = {(<type 'datetime.date'>, <type > 'sqlite3.PrepareProtocol'>)... apilevel = '2.0' > converters = {'DATE': <function convert_date at 0xb7d85454>, > 'TIMESTAM... paramstyle = 'qmark' > sqlite_version = '3.3.10' > sqlite_version_info = (3, 3, 10) > threadsafety = 1 > version = '2.3.2' > version_info = (2, 3, 2) > x = '10' > > Note the adapters/converters for date/datetime. You might want to try that > on the Python 2.5.4 to see if you are getting the same thing.
Larry's windows and both of my version have the same thing as you do. Johnf _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/200910131227.18159.jfabi...@yolo.com