Skip to content
Advertisement

Tag: mysql-connector

Python Mysql Queary not returning results

I have a DB and when I query a table I get 67 results. The SQL is: I try to connect to the DB, and I get no connection errors. It prints out -1 for rowcount. The connection to the DB appears to be working, the SQL is a simple query… Answer Try adding cursor.fetchall() before the print(cursor.rowcount)

How to get column names from a SQL query?

I need to put data from the SQL query into a Pandas dataframe. Please tell me is it possible to get column names the query results? I found that there is a keys() function in sqlalchemy for that but it does not work for me: AttributeError: ‘CMySQLCursor’ object has no attribute ‘keys’ Answer I think that it your are searching

Advertisement