1

Currently I am saving data to QuestDB through Python via the Influx Line Protocol (ILP) like so:

    import socket

    ilp_msg = 'my_table,name=server_timestamp value=12.4\n'
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        sock.connect((HOST, PORT))
        sock.send((ilp_msg).encode())
    except socket.error as e:
        raise ValueError(f'Got error: {e}')
    sock.close()

If there is something wrong with my ilp_msg or the server or the DB, the above code will execute without raising any error. It will log into sdr out (or std err) on the DB.

My question: how can I save data to QuestDB via python and capture any error messages, so that I know that my save method has failed for a particular row.

Newskooler
  • 3,973
  • 7
  • 46
  • 84

1 Answers1

1

The only way I see would be not using ILP but inserting rows by Postgres Driver psycopg2.

ILP seems like one way protocol to stream data to server in the manner of fire and forget.

djbobo
  • 487
  • 2
  • 6
  • Out of curiosity, how can you tell if a protocol is one-way or not? – Newskooler May 18 '21 at 19:59
  • 1
    Protocol does not describe server responses so whatever server sends back is just mess of bytes (if it sends back anything at all). Perhaps Influx itself uses it over HTTP and HTTP response code have some meaning but with QuestDB it's TCP, so you cannot get back response code 200 or 500. – djbobo May 18 '21 at 20:04