I have a single database .pd which I want to disaggregate into several tables to form a single sql database .db
I have previously created the empty .db
data_path = r'C:\Users\User\Desktop\homeworkpython\db.db'
conn = sql.connect(data_path)
cursor = conn.cursor()
The mother base is 'df'.
so, df.head(1)
show
coordinates created_at extended_entities geo id
None Sat Dec 14 NaN None 1
I create my first table
df1 = df[['created_at ','id']]
from sqlalchemy import create_engine
engine = create_engine(r'sqlite:///C:\Users\User\Desktop\homeworkpython\db.db')
df1.to_sql('tab1', engine)
But i have doubts about whether the table was well created and is inside the .db base, how to know?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.