Spaces:
Sleeping
Sleeping
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 |