def get_primary_key_column(self, cursor, table_name):
        # Don't use PRAGMA because that causes issues with some transactions
        cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s", [table_name, "table"])
        results = cursor.fetchone()[0].strip()
        results = results[results.index('(')+1:results.rindex(')')]
        for field_desc in results.split(','):
            field_desc = field_desc.strip()
            m = re.search('"(.*)".*PRIMARY KEY$', field_desc)
            if m:
                return m.groups()[0]
        return None
Get the column name of the primary key for the given table.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/backends/sqlite3/introspection.py/DatabaseIntrospection.get_primary_key_column