From 4c1753fd3f5a081c91249abe883f669603531f56 Mon Sep 17 00:00:00 2001 From: Adrian Ehrsam Date: Thu, 9 Nov 2023 16:04:53 +0100 Subject: [PATCH] better logging --- pyproject.toml | 2 +- src/bulk_insert.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0eb1b11..02758b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "maturin" [project] name = "lakeapi2sql" requires-python = ">=3.10" -version = "0.7.2" +version = "0.7.3" classifiers = [ "Programming Language :: Rust", "Programming Language :: Python :: Implementation :: CPython", diff --git a/src/bulk_insert.rs b/src/bulk_insert.rs index 2ff1490..472a0ed 100644 --- a/src/bulk_insert.rs +++ b/src/bulk_insert.rs @@ -90,17 +90,19 @@ async fn get_cols_from_table( } pub async fn bulk_insert_batch<'a>( + table_name: &str, blk: &mut tiberius::BulkLoadRequest<'a, Compat>, batch: &'a RecordBatch, collist: &'a Vec<(String, ColumnType)>, ) -> Result<(), Box> { let nrows = batch.num_rows(); - info!("received {nrows}"); + info!("{table_name}: received {nrows}"); let rows = get_token_rows(batch, &collist)?; + info!("{table_name}: converted {nrows}"); for rowdt in rows { blk.send(rowdt).await?; } - info!("Written {nrows}"); + info!("{table_name}: Written {nrows}"); Ok(()) } @@ -173,7 +175,7 @@ pub async fn bulk_insert<'a>( &[], ) .await?; - bulk_insert_batch(&mut blk, &v, &collist).await?; + bulk_insert_batch(table_name, &mut blk, &v, &collist).await?; blk.finalize().await?; } let schema = worker.await?; @@ -206,7 +208,7 @@ pub async fn bulk_insert_reader( &[], ) .await?; - bulk_insert_batch(&mut blk, &b, &collist).await?; + bulk_insert_batch(table_name, &mut blk, &b, &collist).await?; blk.finalize().await?; } Err(l) => println!("{:?}", l),