Python MySQL connector returns bytearray instead of regular string value
<p>I am loading data from one table into pandas and then inserting that data into new table. However, instead of normal string value I am seeing bytearray.</p>
<p><code>bytearray(b'TM16B0I8')</code> it should be <code>TM16B0I8</code></p>
<p>What am I doing wrong here?</p>
<p>My code:</p>
<pre><code>engine_str = 'mysql+mysqlconnector://user:pass@localhost/db'
engine = sqlalchemy.create_engine(engine_str, echo=False, encoding='utf-8')
connection = engine.connect()

th_df = pd.read_sql('select ticket_id, history_date', con=connection)

for row in th_df.to_dict(orient=&quot;records&quot;):
    var_ticket_id = row['ticket_id']
    var_history_date = row['history_date']

    query = 'INSERT INTO new_table(ticket_id, history_date)....'
</code></pre>