Spaces:
Sleeping
Sleeping
File size: 513 Bytes
6748588 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import sqlite3
from pandas import DataFrame
DB_FILENAME = 'irembo_application_4.db'
def run_query(query=''):
print(query)
conn = sqlite3.connect(DB_FILENAME)
cursor = conn.cursor()
cursor.execute(query)
#data = cursor.fetchall()
#print(data)
#conn.close()
df = DataFrame(cursor.fetchall())
df.columns = [i[0] for i in cursor.description]
# print(f'Field Names : {field_names}')
print(cursor.description)
print(df.head())
conn.close()
return df |