所以我有一个.sql文件,我想构建到sqllite3的.db文件,但我得到了一个
sqlite3.OperationalError:靠近“ENGINE”:语法错误
任何想法为什么?任何帮助表示赞赏。
import sqlite3
conn = sqlite3.connect('newdatabase.db')
f = open('olddatabase.sql','r')
sql = f.read()
conn.executescript(sql)
conn.close()
输出: Traceback(最近一次调用最后一次): 文件“deleteme.py”,第6行,in conn.executescript(SQL) sqlite3.OperationalError:“ENGINE”附近:语法错误
(程序退出代码:1)
答案 0 :(得分:1)
基于<div id="bootmPanel" style=" box-shadow: 0px 0px 12px rgba(255,255,255,0.7);border: 0px solid rgba(244,244,244,0.7); position: absolute;right:0; bottom: 0;background-color:rgba(52,47,52,.7);width:100%;height:200px" >
<div style="padding:5px;width:105px;height:130px;border:1px solid rgba(244,244,244,1);margin-top: 10px;margin-left: 10px; display:inline-block;">
<img src="https://www.w3schools.com/html/pulpitrock.jpg" width=70px; height:30; alt="Alert" style="margin-top: 5px;margin-left: 10px;">
<p> <span style="color:white;font-size:12px;display:block;width:95px;word-wrap:break-word;">Images can improve the design </span> </p>
</div>
<div style="padding:5px;width:105px;height:130px;border:1px solid rgba(244,244,244,1);margin-top: 10px;margin-left: 10px; display:inline-block;">
<img src="https://www.w3schools.com/html/pulpitrock.jpg" width=70px; height:30; alt="Alert" style="margin-top: 5px;margin-left: 10px;">
<p> <span style="color:white;font-size:12px;display:block;width:95px;word-wrap:break-word;">Images can improve the design </span> </p>
</div>
<div style="padding:5px;width:105px;height:130px;border:1px solid rgba(244,244,244,1);margin-top: 10px;margin-left: 10px; display:inline-block;">
<img src="https://www.w3schools.com/html/pulpitrock.jpg" width=70px; height:30; alt="Alert" style="margin-top: 5px;margin-left: 10px;">
<p> <span style="color:white;font-size:12px;display:block;width:95px;word-wrap:break-word;">Images can improve the design </span> </p>
</div>
<div style="padding:5px;width:105px;height:130px;border:1px solid rgba(244,244,244,1);margin-top: 10px;margin-left: 10px; display:inline-block;">
<img src="https://www.w3schools.com/html/pulpitrock.jpg" width=70px; height:30; alt="Alert" style="margin-top: 5px;margin-left: 10px;">
<p> <span style="color:white;font-size:12px;display:block;width:95px;word-wrap:break-word;">Images can improve the design Images can improve the design </span> </p>
</div>
</div>
进行划分,您有一个由MySQL(ENGINE
或类似的)转储的.sql文件,因此它包含特定于MySQL的扩展。
您必须编辑.sql文件以符合SQLite的标准,或者想出一种将其自动转换为更标准的SQL指令序列的方法。