Is there a way to reliably get an object's package name? I'm trying  to programmatically determine if a connector is from mysqldb, pyscopg2, cx_oracle, or pymssql. I had been using the conn.__class__ and regular expression previously but then stumbled when MySQLdb broke the pattern.
psycopg2:  <type 'psycopg2.extensions.connection'>
oracle:  <type 'cx_Oracle.Connection'>
pymssql:  <type 'pymssql.Connection'>
mysqldb: MySQLdb.connections.Connection
I'm wondering if there's a builtin python method of finding a classes' package. Ideally, this would simply return psycopg2, cx_Oracle, pymssql, or MySQLdb
Yes, thank you, Get fully qualified class name of an object in Python was the first thing that came up when I searched also. psycopg2, cx_oracle, and pymssql all return AttributeError: 'Connection' object has no attribute '__module___'
 
    