Hello Mr. Tutor:

I constructed a pieced of code utilizing requests and pyodbc to download 
creditcard statement transactions and insert them into a DB table based on the 
code published by Louis Millette here: 
https://github.com/louismillette/Banking/tree/master.

Now I am a total newbie to Python even though I had some experience writing in 
other languages. The code works like a charm until where it comes to inserting 
the transactions into the table. As you can see in my code, in order to avoid 
duplicates being inserted into the table I’m trying to compared the downloaded 
statement line to each existing line in the table through nested loop and 
insert only when there’s no match. I kind of intuitively expect that there is 
another much simpler way to compare each downloaded line to all the inserted 
lines and find out if it is already in there. Obviously the approach I’m using 
doesn’t really work as I want it to. Can you please give me some hints as to 
how to get the loops to work as I explained or, if there is another better way 
to do it, what would that look like?

Thanks a lot for your guidance.

Kaun



       KUAN LU, CPA, CGA  |  FINANCE TEAM LEAD

________________________________
      Email: k...@talize.com |
      Tel.:416-757-7008,212 | Fax.:416-757-9656
            67 Alexdon Rd. Unit 1, North York, M3J 2B5         
[cid:image8b62b4.PNG@56bf8aa6.478ff844] <http://www.talize.com>

       [cid:image60c6be.PNG@4e534b25.42997eac] 
<http://www.linkedin.com/company/talize/>   
[cid:imagecf6195.PNG@85b08044.4f853faf] 
<http://www.instagram.com/talizethrift/>   
[cid:image5aee5c.PNG@df0af238.4cb43c7f] <http://www.facebook.com/TalizeThrift>  
 [cid:image53396f.PNG@356ad215.46ac24a4] 
<https://plus.google.com/+TalizeThriftStoreTalizeThriftStore>   
[cid:imagede763d.PNG@0b16b53d.47948094] <https://twitter.com/TalizeThrift>

The information transmitted, including attachments, is intended only for the 
person(s) or entity to which it is addressed and may contain confidential 
and/or privileged material. Any review, retransmission, dissemination or other 
use of, or taking of any action in reliance upon this information by persons or 
entities other than the intended recipient is prohibited. If you received this 
in error please contact the sender and destroy any copies of this information.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to