My first SQL database im using sqlite3 in idle on linux. Everything is working fine but I want my table to display in an easier to read format in the terminal. been reading about dot commands eg .mode column
or .headers on
but not sure were to put it in my code, i think this is the closest:
def veiw_outstanding_job():
cursorObj = con.cursor()
cursorObj.execute('.mode column\nSELECT * FROM '+ VesselName + ' WHERE State = "outstanding" ')
rows = cursorObj.fetchall()
for row in rows:
print(row)
menu()
but i get this error
Traceback (most recent call last): File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode exec(code, self.locals) File "/home/mike/Documents/Maintenance Manager/Maintenance Manager.py", line 238, in <module> menu() File "/home/mike/Documents/Maintenance Manager/Maintenance Manager.py", line 27, in menu veiw_job(con) File "/home/mike/Documents/Maintenance Manager/Maintenance Manager.py", line 54, in veiw_job cursorObj.execute('.mode column\nSELECT * FROM '+ VesselName) sqlite3.OperationalError: near ".": syntax error
.mode column
is not SQL statement. Maybe you mean client (sqlite shell) command? but you do not use any client...