con execute(querycon commit(theninsert few rows of datadata [('atlanta''georgia' )('tallahassee''florida' )('sacramento''california' )stmt "insert into test values(????)con executemany(stmtdatacon commit(most python sql drivers (pyodbcpsycopg mysqldbpymssqletc return list of tuples when selecting data from tablein [ ]cursor con execute('select from test'in [ ]rows cursor fetchall(in [ ]rows out[ ][( 'atlanta' 'georgia' )( 'tallahassee' 'florida' )( 'sacramento' 'california' )you can pass the list of tuples to the dataframe constructorbut you also need the column namescontained in the cursor' description attributein [ ]cursor description out[ ]((' 'nonenonenonenonenonenone)(' 'nonenonenonenonenonenone)(' 'nonenonenonenonenonenone)(' 'nonenonenonenonenonenone)in [ ]dataframe(rowscolumns=zip(*cursor description)[ ]out[ ] atlanta georgia tallahassee florida sacramento california this is quite bit of munging that you' rather not repeat each time you query the database pandas has read_frame function in its pandas io sql module that simplifies the process just pass the select statement and the connection objectin [ ]import pandas io sql as sql in [ ]sql read_frame('select from test'conout[ ] atlanta georgia tallahassee florida sacramento california interacting with databases www it-ebooks info