Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Pip install Teradata
  2.  
  3. import teradata
  4. import pyodbc
  5. import sys
  6.  
  7.  
  8.  
  9. udaExec = teradata.UdaExec (appName="HelloWorld", version="1.0",
  10. logConsole=False)
  11.  
  12. session = udaExec.connect(method="odbc", dsn="prod32",
  13. username="PRODRUN", password="PRODRUN");
  14.  
  15. i = 0
  16. REJECTED = 'R';
  17.  
  18. f = file("output.txt","w");sys.stdout=f
  19.  
  20. cursor = session.cursor();
  21.  
  22. ff_remaining = 0;
  23.  
  24. cnt = cursor.execute("SELECT SEQ_NO,FRQFBKDC,PNR_RELOC FROM ttemp.ffremaining ORDER BY 1,2,3 ").rowcount;
  25. rows = cursor.execute("SELECT SEQ_NO,FRQFBKDC,PNR_RELOC FROM ttemp.ffremaining ORDER BY 1,2,3 ").fetchall();
  26.  
  27.  
  28. for i in range(cnt):
  29. ff_remaining = cursor.execute("select count(*) as coun from ttemp.ffretroq_paxoff where seq_no=? and status <> ?",(rows[i].seq_no,REJECTED)).fetchall();
  30. print ff_remaining[0].coun, rows[i].seq_no, REJECTED;
  31.  
  32. import pyodbc
  33.  
  34. user = 'user'
  35.  
  36. pasw = 'pass'
  37.  
  38. host = 'host'
  39.  
  40. connection = pyodbc.connect('DRIVER=Teradata;DBCNAME=' + host +';UID=' + user + ';PWD=' + pasw +';QUIETMODE=YES', autocommit=True,unicode_results=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement