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/Maintenanceanager.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
(also asked on database admin stackexchange and got sent here)