Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
minus34 committed Feb 8, 2018
1 parent 126ec0e commit 930d0d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion pg-exporter/pg2xls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import logging.config
import os
import psycopg2 # module needs to be installed
import tempfile
# import tempfile
import zipfile

from datetime import datetime
Expand Down
23 changes: 0 additions & 23 deletions pg-exporter/pg_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@
import __main__ as m # get the calling script


def get_pif_summary(pg_cur, loc_pid):

start_time = datetime.now()

brands = list()

try:
pg_cur.execute("SELECT brand, SUM(si) AS si, Count(*) AS pif FROM pif.mv_all_pif "
"WHERE locpid = '{}' GROUP BY brand ORDER BY brand".format(loc_pid,))
rows = pg_cur.fetchall()

except Exception as ex:
m.logger.fatal("unable to get PIF summary : {}".format(ex,))
return None

for row in rows:
brands.append(row[0])

m.logger.info("got PIF summary : {}".format(datetime.now() - start_time))

return brands


def run_query(pg_cur, sql):
"""Exports query to the chosen format"""

Expand Down

0 comments on commit 930d0d9

Please sign in to comment.