Actually, try this one - I changed line 35
def db_query():
""" Connect to the PostgreSQL database server """
# read connection parameters
params = config()
# connect to the PostgreSQL server
print('Connecting to the PostgreSQL database...')
with psycopg2.connect(**params) as conn:
# create a cursor
with conn.cursor() as cur:
try:
cur.execute("SELECT t.id, t.\"vendorField\" FROM transactions t WHERE t.\"vendorField\" LIKE 'geo%'")
print("Rows returned: ", cur.rowcount)
geo_data = cur.fetchall()
except psycopg2.DatabaseError as db_error:
print(db_error)
geo_data = []
finally:
print('Database connection closed.')
return geo_data
db_query() should not process data, it need to query the DB and just return data as tuple of tuples
If problem persist, I will look into it when I get home