try building a python script to get info from the db

This commit is contained in:
Paul Trowbridge 2019-12-18 16:19:21 -05:00
parent 01ab34ec2b
commit 7f89feba83

28
version.py Normal file
View File

@ -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()