Package Products :: Package ZenUtils :: Module mysql
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenUtils.mysql

 1  ############################################################################## 
 2  #  
 3  # Copyright (C) Zenoss, Inc. 2012, all rights reserved. 
 4  #  
 5  # This content is made available according to terms specified in 
 6  # License.zenoss under the directory where your Zenoss product is installed. 
 7  #  
 8  ############################################################################## 
 9   
10   
11  # Tries to import MySQLdb C library first, then falls back to pymysql 
12  try: 
13      import MySQLdb 
14  except ImportError: 
15      try: 
16          import pymysql 
17          pymysql.install_as_MySQLdb() 
18          import MySQLdb 
19      except Exception: 
20          raise ImportError("No suitable MySQL module found") 
21