MySQLdb - weird formatting inconsistency

John Nagle nagle at animats.com
Sat Apr 24 16:09:50 EDT 2010


Anthra Norell wrote:
> Hi all,
> 
>    Can anyone explain this? Three commands with three different cutoff 
> dates (12/30, 12/31 and 1/1) produce a formatting inconsistency. Examine 
> the third field. The first and last run represents it correctly. The 
> second run strips it. The field happens to be a record ID and getting it 
> stripped in an unpredictable manner obviously makes it useless as an ID.
> 
>  >>> finance.execute ('select * from j where Date between "1987-01-01" 
> and "1987-12-30";')
> 761L
>  >>> for item in finance: print item
> 
> (9737, '', ' 2278', datetime.date(1987, 1, 1), 5000.0, 'IIfVNg', 'IIfAC', '', '', 'Schweigegeld')
> (9738, '', ' 2279', datetime.date(1987, 1, 5), 28.5, 'IIfVZc', 'IIfAC', '', '', '1 Schachtel 9mm')
> (9739, '', ' 2280', datetime.date(1987, 1, 5), 73.85, 'IIfVZm', 'IIfAC', '', '', 'Gladiolen')
> . . .
> 
>  >>> finance.execute ('select * from j where Date between "1987-01-01" 
> and "1987-12-31";')
> 792L
>  >>> for item in finance: print item
> (9737, '', '2278', datetime.date(1987, 1, 1), 5000.0, 'IIfVNg',  'IIfAC', '', '', 'Schweigegeld')
 > (9738, '', '2279', datetime.date(1987, 1, 5), 28.5, 'IIfVZc', 'IIfAC',  '', 
'', '1 Schachtel 9mm')
> (9739, '', '2280', datetime.date(1987, 1, 5), 73.85, 'IIfVZm', 'IIfAC', '', '', 'Gladiolen')
> . . .

    Those are the first and second runs.  Where, exactly, do they differ?

				John Nagle



More information about the Python-list mailing list