Skip to content

Commit

Permalink
Replaced PrettyTable with tabulate
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jendryke committed Dec 7, 2017
1 parent 83ea67a commit ae1fb5f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ntl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ dependencies:
- setuptools
- wheel
- zlib
- prettytable
- tabulate
3 changes: 3 additions & 0 deletions nyx.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def create_arg_parser():
)
parser.add_argument(
'-o', '--orderNumber',
nargs='+',
default="",
help='The Order Number from NOAA CLASS'
)
Expand Down Expand Up @@ -167,6 +168,8 @@ def main(argv):
print('Something went wrong')
elif mode == 'addOrder':
print('Add a new order')
print(parsed_args.orderNumber)
exit()
orderNumber = checkInput.orderNumber(parsed_args.orderNumber)
server = checkInput.server(parsed_args.server)
directory = checkInput.path(parsed_args.path)
Expand Down
16 changes: 9 additions & 7 deletions sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
except:
print('Cannot find psycopg2')
import configparser
from prettytable import PrettyTable
from tabulate import tabulate

config = configparser.ConfigParser()
config_file = os.path.join(os.path.dirname(__file__), 'settings.cfg')
Expand Down Expand Up @@ -85,13 +85,15 @@ def printSQL(s, d):
conn.commit()
disconnect(conn, cur)

x = PrettyTable(colnames)
x.padding_width = 1
x.max_table_width = 10
table = []

for row in rows:
x.add_row(row)
print(x)

r = []
for col in row:
r.append(col)
print(r)
table.append(r)
print(tabulate(table, headers=colnames, tablefmt="fancy_grid"))

def setOrderStatus(o, s):
SQL = "UPDATE orders set status = %s where ordernumber = %s"
Expand Down

0 comments on commit ae1fb5f

Please sign in to comment.