*.sql文件導(dǎo)入數(shù)據(jù)庫通常比較方便。 其他格式如csv,、xsl等文件導(dǎo)入比較費勁,。 推薦一個針對csv\xsl的導(dǎo)入工具:https://github.com/zhengze/file_to_db.git 如果文件第一行是table的字段名,自動建表+導(dǎo)入數(shù)據(jù),,實在是省事,。 具體用法請看README: load data from csv/xlsx into database(mysql/postgresql) INSTALL
CONFIG
USAGE
python file_to_db.py -f user -t ./test.csv
name,age zhangsan,15
|
|
來自: python_lover > 《待分類》