From 7f89feba83ab67e584948e40dda7dba3201e8afa Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 18 Dec 2019 16:19:21 -0500 Subject: [PATCH] try building a python script to get info from the db --- version.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 version.py diff --git a/version.py b/version.py new file mode 100644 index 0000000..b8236f6 --- /dev/null +++ b/version.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import psycopg2 +import sys + +con = None + +try: + + con = psycopg2.connect(database='ubm', user='ptrowbridge', port=5030, host='usmidlnx01', + password='qqqx53!030') + + cur = con.cursor() + cur.execute('SELECT code, url FROM scrape.raw') + + version = cur.fetchone()[1] + print(version) + +except psycopg2.DatabaseError as e: + + print(f'Error {e}') + sys.exit(1) + +finally: + + if con: + con.close() \ No newline at end of file