0

I have a PostgreSQL DB on a remote ubuntu server. My Python script is able to write to the DB, with the use of these configuration.

def get_query(group_name , heb_sale_rent ,heb_street, heb_city , heb_rooms , heb_size , heb_floor , heb_porch , heb_storage , heb_mamad , heb_parking , heb_elevator , heb_phone , heb_price):
    conn = psycopg2.connect(database='my_db', host='192.168.72.130', port='5432', user='sql_user', password='sql_user')
    cur = conn.cursor()
    cur.execute("SELECT * FROM to_excel")
    query = cur.fetchall()
    print(query)

#Result of print - [('1', 'Karin', 'מכירה, השכרה', 'רחוב, ברובע', 'שכונת, בסמטאות', 'חדרים', 'מ״ר, מ"ר', 'קומה', 'מרפסת', 'מחסן', 'ממד, ממ״ד', 'חניה, חנייה, חניית, חנית', 'מעלית', '054, 052, 053', 'מחיר, מבקשים', '2020-01-01')]

I can see that there is data because it prints out the query, but when I connect to the DB on the ubuntu there are no table rows... so weird. Does anybody know what the problem might be?

enter image description here

KarinP
  • 101
  • 1
  • 7

1 Answers1

0

Use a semicolon at the end of your commands.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
KarinP
  • 101
  • 1
  • 7