Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple writes in temp tables #63

Open
innuendonh opened this issue Dec 31, 2024 · 2 comments
Open

Multiple writes in temp tables #63

innuendonh opened this issue Dec 31, 2024 · 2 comments

Comments

@innuendonh
Copy link

Hello, is there any way to write into the same temp table multiple times?

For example, I would like to bulk insert different batches of data (potentially large, i do not want to concat them in memory) into the same temp table, then use the table to perform queries, and finally dispose it.

Specifically, I use Sqlite as a containter to move data between different MS SqlServer databases in different hosts, and I need a way to load and write potentially big tables without worrying about the memory occupation, so this kind of functionality would be extremely useful.

Thank you!

@PawelGerr
Copy link
Owner

Currently, there is no api to provide the name of existing (temp) table to methods like BulkInsertAsync.

@PawelGerr
Copy link
Owner

I've added multiple overloads of BulkInsert*IntoTempTable in version 8.4.0/9.2.0

// creates a new temp table and inserts 1 record
await using var tempTable = await ActDbContext.BulkInsertIntoTempTableAsync(new List<CustomTempTable> { new(1, "value") });

// insert another record into exising `tempTable`
await ActDbContext.BulkInsertIntoTempTableAsync(new List<CustomTempTable> { new(2, "value2") }, tempTable);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants