https://questdb.io logo
Title
s

sam

12/13/2022, 10:35 PM
df = pd.read_csv(latest_file).reindex()
##print(df)
#
#
def insert_row(host: str = '192.168.1.15', port: int = 9009):
    table_name: str = str(uuid.uuid1())
    watermark = 1024  # Flush if the internal buffer exceeds 1KiB
    with Sender(host=host, port=port, auto_flush=watermark) as sender:
        total_rows = 0
        last_flush = time.monotonic()
        print('Inserting row...')
        for index, row in df.iterrows():
             # Print the index and values of each row
             #print(f"Row {index}: {row}")
             print(row.to_dict())
             sender.row(
             'hist-ohlc-daily',                      ####TABLE NAME
             columns=row.to_dict())
             total_rows += 1

        # If the internal buffer is empty, then auto-flush triggered.
        if len(sender) == 0:
            print('Auto-flush triggered.')
            last_flush = time.monotonic()
        # Flush at least once every five seconds.
        if time.monotonic() - last_flush > 30:
            print('Timer-flushing triggered.')
            sender.flush()
            last_flush = time.monotonic()
            
        print(f"table: {table_name}, total rows sent: {total_rows}")
        print("(wait commitLag for all rows to be available)")
        print("bye!")

if __name__ == '__main__':
    insert_row()
n

Nicolas Hourcard

12/14/2022, 11:08 AM
hey @Sam let us look into this. @Eugene or @Bolek Ziobrowski are experts on this and should be able to help
b

Bolek Ziobrowski

12/14/2022, 11:15 AM
By default ILP disconnects on error but there should be a description of the issue in qdb logs . QuestDB supports csv imports via /imp rest endpoint and COPY sql commands .
s

sam

12/15/2022, 7:02 AM
i changed watermark to 0. it worked