def get_content(self):
filestream = compat.StringIO()<EOL>tableName, primKey = self.provider._split_path(self.path)<EOL>if primKey is not None:<EOL><INDENT>conn = self.provider._init_connection()<EOL>listFields = self.provider._get_field_list(conn, tableName)<EOL>csvwriter = csv.DictWriter(filestream, listFields, extrasaction="<STR_LIT:ignore>")<EOL>dictFields = {}<EOL>for field_name in listFields:<EOL><INDENT>dictFields[field_name] = field_name<EOL><DEDENT>csvwriter.writerow(dictFields)<EOL>if primKey == "<STR_LIT>":<EOL><INDENT>cursor = conn.cursor(MySQLdb.cursors.DictCursor)<EOL>cursor.execute("<STR_LIT>" + self.provider._db + "<STR_LIT:.>" + tableName)<EOL>result_set = cursor.fetchall()<EOL>for row in result_set:<EOL><INDENT>csvwriter.writerow(row)<EOL><DEDENT>cursor.close()<EOL><DEDENT>else:<EOL><INDENT>row = self.provider._get_record_by_primary_key(conn, tableName, primKey)<EOL>if row is not None:<EOL><INDENT>csvwriter.writerow(row)<EOL><DEDENT><DEDENT>conn.close()<EOL><DEDENT>filestream.seek(<NUM_LIT:0>)<EOL>return filestream<EOL>
Open content as a stream for reading.

        See DAVResource.get_content()