Advertisement
Guest User

Untitled

a guest
Apr 12th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.40 KB | None | 0 0
  1. import psycopg2                                                                          
  2. import sys                                                                                
  3.                                                                                              
  4. udid = input("UDID: ")                                                                    
  5.                                                                                              
  6.                                                                                              
  7. def get_emplid(udid):                                                                    
  8.                                                            
  9.                                                                                            
  10.   conn_db = psycopg2.connect(dbname=, host=, sslmode='require', user=, password=)
  11.   curs = conn_db.cursor()                                                              
  12.   curs.execute("select emplid from emplid_to_alphaname where alphaname = (%s);", (udid,))
  13.   row = curs.fetchone()                                                                
  14.   if row == None:                                                                      
  15.     sys.exit("Could not locate Employee ID for {}".format(udid))                      
  16.                                                                                            
  17.                                                                                            
  18.   db_emplid = row[0]                                                                    
  19.                                                                                            
  20.                                                                                            
  21.   conn_db.close()                                                                      
  22.                                                                                            
  23.   return db_emplid                                                                      
  24.                                                                                            
  25. def add_user_to_db():                                                                    
  26.   db_emplid = get_emplid                                                              
  27.   db_emplid = db_emplid                                                                
  28.   print(db_emplid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement