doing some benchmarking with quest using Python. Have below function to generate a dataframe.
def generate_test_data(iteration, columns):
# Create a list of column names (just generic names ‘col_0’, ‘col_1’, …)
col_names = [f"col{i}" for i in range(columns)]
# Initialize the start time as current time
start_time = dt.datetime.now()
# Generate index as time series starting from current time, incremented by 1 ms
time_index = [start_time +
dt.timedelta(milliseconds=i) for i in range(iteration)]
# Generate random data for the DataFrame (random floats in this case)
data = np.random.rand(iteration, columns)
data = np.asarray(data, order='C')
# Create DataFrame with generated time index
df = pd.DataFrame(data, columns=col_names, copy=True)
df['timestamp'] = time_index
print(df)
return df
The code to push into quest is pretty straight forward.
def write_df(df: pd.DataFrame, table: str):
with Sender.from_conf(conf) as sender:
sender.dataframe(
df, table_name=table, at=“timestamp”
)
if the dimension is more than 1 column, i am getting
File “src/questdb/ingress.pyx”, line 2403, in questdb.ingress.Sender.dataframe
File “src/questdb/dataframe.pxi”, line 2396, in questdb.ingress._dataframe
File “src/questdb/dataframe.pxi”, line 2296, in questdb.ingress._dataframe
File “src/questdb/dataframe.pxi”, line 1177, in questdb.ingress._dataframe_resolve_args
File “src/questdb/dataframe.pxi”, line 1117, in questdb.ingress._dataframe_resolve_cols
File “src/questdb/dataframe.pxi”, line 1017, in questdb.ingress._dataframe_resolve_source_and_buffers
File “src/questdb/dataframe.pxi”, line 814, in questdb.ingress._dataframe_series_as_pybuf
questdb.ingress.IngressError: Bad column ‘col0’: ndarray is not C-contiguous