EFCore Bulk Insert & SQLite In Memory: no such table: INFORMATION_SCHEMA.COLUMNS"

c# entity-framework-core in-memory-database sqlbulkcopy sqlite


I'm using BulkExtensions for EFCore 2.5.0 together with EFCore.SQLite 2.2.6 and Entity Framework Core 2.2.3.

I have the following code:

// Repo that throws exception on BulkInsert
public class UserRepository
   private readonly IDbContextProvider<ReportContext> _dbContextProvider;

   public async Sync(IList<User> users)
        await _dbContextProvider.Context.BulkInserOrUpdateAsync(users);

// Poco Model
public class User
   public string Id {get;set;}
   public string Name {get; set;}

// Simple DbContext
public class ReportsContext : DbContext
   public DbSet<User> Users { get; set; }

Code for my program, whichEFCore.Sql ) does this flawlessly. However, I get an issue when my test code executes using SQLite in memory:


Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'no such table: INFORMATION_SCHEMA.COLUMNS'.

at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
at EFCore.BulkExtensions.TableInfo.CheckHasIdentityAsync(DbContext context, CancellationToken cancellationToken)
at EFCore.BulkExtensions.SqlBulkOperation.MergeAsync[T](DbContext context, IList1 entities, TableInfo tableInfo, OperationType operationType, Action1 progress, CancellationToken cancellationToken)
at MyCode.Repositories.UserRepository.<>c__DisplayClass5_0.<b__0>d.MoveNext() in C:\projects\MyCode\Repositories\UserRepository.cs:line 48

INFORMATION_SCHEMA.COLUMNS is not something I'm attempting to produce or work with, and it is not a component of my data model. Does EF Core or SQLite need any configuration or tinkering in order to allow bulk operations while operating in memory mode?

I've attempted logging for EF Core is enabled, but there is no output on the bulk operations, just the processing of my database model and the creation of tables, so I'm not sure what produced SQL statements are seeking for this.Information_Schema.Columns table.

3/15/2020 9:38:09 PM

Accepted Answer

This seems to be an EFCore problem. for BulkExtensions2.5.0 when it lacked complete SQLite support. With version, it operates2.6.4 : 11 zzz zzz

3/17/2020 8:13:19 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow