m

    Michal Zeman

    1 week ago
    Hi guys, we would like to write and read binary data to/from QuestDB. We are using Python direct writer and/or WebUI. I was unable to write binary data with Python or WebUI. Is there a way to do it in WebUI? Thanks
    Andrey Pechkurov

    Andrey Pechkurov

    1 week ago
    Hi Michal, You should be able to write and read binary values via PG Wire (so, a Postgres driver, like psycopg).
    m

    Michal Zeman

    1 week ago
    Hi Andrey, do you have an example of the usage of this driver? Tbh I don't get how a driver can help me if it is not more of a protocol than a driver.
    As for the protocol vs. driver, Postgres driver uses PG Wire protocol and we support binary data reads and writes over PG Wire protocol.
    m

    Michal Zeman

    1 week ago
    Thanks for the clarification. But with psycopg2 I have run to the same problem as here: https://github.com/questdb/questdb/issues/1187
    Andrey Pechkurov

    Andrey Pechkurov

    1 week ago
    It seems to work fine with psycopg 3 for me:
    import psycopg
    
    with psycopg.connect("dbname=qdb user=admin password=quest host=localhost port=8812") as conn:
    
        with conn.cursor() as cur:
    
            cur.execute("CREATE TABLE IF NOT EXISTS binary_table (name STRING, binary_data BINARY);")
            cur.execute("INSERT INTO binary_table VALUES (%s,%s)", ('Hello', b'b string'))
            conn.commit()
    
            for record in cur.execute("SELECT * FROM binary_table"):
                print(record)
    Duplicated the snippet on the GH issue
    m

    Michal Zeman

    1 week ago
    will try, thanks
    yeap in psycopg 3 it is working. but WebUI does not show anything and neither does downloading data via WebUI. But we can live with that. Thanks, Andrei 🙂
    Andrey Pechkurov

    Andrey Pechkurov

    1 week ago
    Yes, if I'm not mistaken, HTTP API doesn't support binary columns. If you think it would be valuable for your needs, please create a GH issue to track this enhancement:https://github.com/questdb/questdb/issues/new?assignees=&labels=New+feature&template=feature_request.yml