Mar-06-2018, 02:26 PM
Pages: 1 2
Mar-06-2018, 02:31 PM
Actually, try this one - I changed line 35
If problem persist, I will look into it when I get home
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_datadb_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
Mar-06-2018, 05:02 PM
Thank you, it works perfectly.
Really appreciated!
Really appreciated!
Pages: 1 2