0
Dear, How to retrieve database information by column names and not by indexes?
cursor.execute('SELECT * FROM [AutomacaoCampanhasDashboard].[dbo].[TBL_GCCP2]')
row = cursor.fetchall()
nome = row[0][1]
endereco = row[1][2]
print(nome)
print(endereco)
I’d like to retrieve the information in that way:
nome = row[Nome]
endereco = row[endereco]
print(nome)
print(endereco)
Thinking about helping people using mysql, this only works if: crs = Conn.cursor(named_tuple=True) Ref.: https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqursornamedtuple.html
– OseiasSlompo