1

The file path column in my database is being cut off and I haven't been able to find any documentation saying how to specify the column width in python. I'm currently using pandas to print the database in the terminal.

Database printout:

                                                    Path     Status                 Time
0                                      pytest_file.c       Safe  2018-06-11 10:33:29
1  /Users/me/Documents/to_scan/SSpres...  File Sent  2018-06-11 10:45:05
2  /Users/me/Downloads/SampleData/Eli...  File Sent  2018-06-11 10:45:33
3  /Users/me/Downloads/SampleData/Eli...  File Sent  2018-06-11 10:45:34
4  /Users/me/Downloads/SampleData/Lec...  File Sent  2018-06-11 10:45:35
5  /Users/me/temp/ess-dive-volumes/var...       Safe  2018-06-11 11:46:02
6  /Users/me/temp/ess-dive-volumes/var...       Safe  2018-06-11 11:46:18
7  /Users/me/temp/ess-dive-volumes/var...       Safe  2018-06-11 11:46:34
8  /Users/me/temp/ess-dive-volumes/var...       Safe  2018-06-11 11:46:50

Code for printing database:

con = sqlite3.connect(data_base)
return pd.read_sql_query('''SELECT Path, Status, Time FROM files_db''', con)

print(print_db(database))
Edsel Norwood
  • 149
  • 1
  • 2
  • 11
  • Hey check this out `https://stackoverflow.com/q/1751189/8150371` – Stack Jun 12 '18 at 16:36
  • I read through this post. Seems like they're using unix commands. I'm looking for a solution that I can use in python. I haven't any luck with the .width command either (I don't think it exist in the sqlite3 python lib). – Edsel Norwood Jun 12 '18 at 16:40

1 Answers1

1

Turns out that pandas was the limiting factor and not sqlite3. I solved this issue by manually setting pd.options.display.max_colwidth to 255.

The single line that solved this:

pd.options.display.max_colwidth = 255
Edsel Norwood
  • 149
  • 1
  • 2
  • 11