MySQL Problem
Victor Subervi
victorsubervi at gmail.com
Thu Sep 2 14:34:46 EDT 2010
Hi;
I have this code:
print 'select * from spreadsheets s join products p on p.Item=s.Item
join productsCategories pc on p.ID=pc.ProductsID join categories c on
pc.CategoryID=c.ID where s.Client="%s" order by c.Category, c.Parent' %
(client,)
cursor.execute('select * from spreadsheets s join products p on
p.Item=s.Item join productsCategories pc on p.ID=pc.ProductsID join
categories c on pc.CategoryID=c.ID where s.Client=%s order by c.Category,
c.Parent', (client,))
tmp = cursor.fetchall()
print tmp
Now, when I run the print of the mysql command in the mysql interpreter, it
gives me the following data:
mysql> select * from spreadsheets s join products p on p.Item=s.Item join
productsCategories pc on p.ID=pc.ProductsID join categories c on
pc.CategoryID=c.ID where s.Client='Lincoln_Properties' order by c.Category,
c.Parent;
+-----+--------------------+-------+------------+--------+------+-----+------------+------------------------------------------------------+---------+-------+-----+------------+------------+----+-------------------+----------------------+
| ID | Client | Multi | Item | Markup | Temp | ID |
Item | Description | UOM
| Cost | ID | ProductsID | CategoryID | ID | Category |
Parent |
+-----+--------------------+-------+------------+--------+------+-----+------------+------------------------------------------------------+---------+-------+-----+------------+------------+----+-------------------+----------------------+
| 163 | Lincoln_Properties | 0 | 5349513 | 53.22 | NULL | 39 |
5349513 | 24833RNH 24" x 33 " 8 Mic Natural Can Liners | 1000/CS
| 25.63 | 39 | 39 | 23 | 23 | Can Liners |
Bags |
| 156 | Lincoln_Properties | 0 | 5349520 | 30.00 | NULL | 31 |
5349520 | Can Liners Coreless 45 gal Clear | 250/CS
| 28.69 | 31 | 31 | 23 | 23 | Can Liners |
Bags |
| 161 | Lincoln_Properties | 0 | 40x48Green | 99.32 | NULL | 37 |
40x48Green | Green Can Liners | 1000/cs
| 17.56 | 37 | 37 | 23 | 23 | Can Liners |
Bags |
| 160 | Lincoln_Properties | 0 | 24x33Green | 60.04 | NULL | 36 |
24x33Green | Green Can Liners | 1000/CS
| 20.27 | 36 | 36 | 23 | 23 | Can Liners |
Bags |
| 162 | Lincoln_Properties | 0 | 5349518 | 26.02 | NULL | 38 |
5349518 | 28048VNR01 40" x 48" HI-D | 250/CS
| 25.63 | 38 | 38 | 1 | 1 | Facility Supplies |
BASE |
| 152 | Lincoln_Properties | 0 | 4440120 | 72.44 | NULL | 35 |
4440120 | 91315 Pearlescent White Lotion Gallon Soap | 4/CS
| 17.85 | 35 | 35 | 67 | 67 | Liquid Hand |
Soap |
| 609 | Lincoln_Properties | 0 | 2030572 | 0.00 | 1 | 343 |
2030572 | Americo 20" Beige Floor Pad | 5/cs
| 15.88 | 335 | 343 | 49 | 49 | Mats |
Restaurant Paper/Pla |
| 159 | Lincoln_Properties | 0 | 2028071 | 20.00 | NULL | 34 |
2028071 | 25025088 77 Sanisac Liner | 500/CS
| 14.88 | 34 | 34 | 34 | 34 | Tampons | Bathroom
Paper |
| 158 | Lincoln_Properties | 0 | 2062866 | 33.31 | NULL | 33 |
2062866 | 7410 1/2 Fold Seat Cover | 3000/CS
| 35.81 | 33 | 33 | 35 | 35 | Toilet Seat Cover | Bathroom
Paper |
| 155 | Lincoln_Properties | 0 | 5380447 | 30.00 | NULL | 30 |
5380447 | Scottfold Foldedd Towel 1-Ply White | 4375/CS
| 35.00 | 30 | 30 | 33 | 33 | Toilet Tissue | Bathroom
Paper |
| 154 | Lincoln_Properties | 0 | 5207270 | 7.01 | NULL | 29 |
5207270 | Standard Roll Bath Tissue 2-Ply White | 80/CS
| 43.50 | 29 | 29 | 33 | 33 | Toilet Tissue | Bathroom
Paper |
| 164 | Lincoln_Properties | 0 | 5207269 | 20.00 | NULL | 28 |
5207269 | 17713-00 Kleenex Cottonelle 2-Ply Toilet Tissue | 60/CS
| 35.50 | 28 | 28 | 33 | 33 | Toilet Tissue | Bathroom
Paper |
| 157 | Lincoln_Properties | 0 | 5217344 | 17.49 | NULL | 32 |
5217344 | 1900-60 Kleenex Scottfold White Towel | 2400/CS
| 26.81 | 32 | 32 | 32 | 32 | Towels | Bathroom
Paper |
+-----+--------------------+-------+------------+--------+------+-----+------------+------------------------------------------------------+---------+-------+-----+------------+------------+----+-------------------+----------------------+
13 rows in set (0.00 sec)
You will notice there is this data therein:
| 609 | Lincoln_Properties | 0 | 2030572 | 0.00 | 1 | 343 |
2030572 | Americo 20" Beige Floor Pad | 5/cs
| 15.88 | 335 | 343 | 49 | 49 | Mats |
Restaurant Paper/Pla |
That particular item does *not* show up when I print tmp! That is, for some
reason running the command through python *omits* this one data!! The only
difference is that a flag in spreadsheets (Temp) is set to 1. Why on earth
doesn't it work in python??
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100902/9a098499/attachment.html>
More information about the Python-list
mailing list