Code:
import sqlite3
def create_connection(db_file):
try:
conn = sqlite3.connect("vienkarsaDB.db3")
except Exception as err:
print("Exception occured while trying to make connection", err)
else:
try:
cur=conn.cursor()
query= """SELECT * Cilvēki"""
cur.execute(query)
row=cur.fetchall()
print(row)
except Exception as err:
print("Exception occured while fetching the records", err)
else:
print("Completed")
finally:
cur.close()
finally:
conn.close()
return conn
create_connection("vienkarsaDB.db3")
Outprint:
Exception occured while fetching the records near "Cilvēki": syntax error
I want to print my SQL table row, which I have imported, row name, table name, checked, both names entered correctly. Can anybody explain why it didn't print what I wanted? Thank you!
Syntax of your query is not right. You need to use from before table name
Instead of
SELECT * Cilvēki
Please use
SELECT * from Cilvēki
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.