Skip to content

Commit

Permalink
Merge pull request #6 from bmsuisse/cffi
Browse files Browse the repository at this point in the history
better logging
  • Loading branch information
aersam authored Nov 9, 2023
2 parents ba72a34 + 4c1753f commit 8c480b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions src/bulk_insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TcpStream>>,
batch: &'a RecordBatch,
collist: &'a Vec<(String, ColumnType)>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
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(())
}

Expand Down Expand Up @@ -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?;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8c480b9

Please sign in to comment.