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

SQLite In-Memory 'no such table: INFORMATION_SCHEMA.COLUMNS' #308

Closed
ppittle opened this issue Mar 15, 2020 · 1 comment
Closed

SQLite In-Memory 'no such table: INFORMATION_SCHEMA.COLUMNS' #308

ppittle opened this issue Mar 15, 2020 · 1 comment

Comments

@ppittle
Copy link

ppittle commented Mar 15, 2020

Cross posting with this StackOverflow question: https://stackoverflow.com/questions/60690567/efcore-bulk-insert-sqlite-in-memory-no-such-table-information-schema-columns

I'm using EFCore BulkExtensions2.5.0 with EntityFrameworkCore 2.2.3 and EFCore.SQLite 2.2.6.

I have some code like:

public class UserRepository
{
   private readonly IDbContextProvider<ReportContext> _dbContextProvider;
  
   public async Sync(IList<User> users)
   { 
        await _dbContextProvider.Context.BulkInserOrUpdateAsync(users);
   }
}

My application code (which uses EFCore.Sql) runs this just fine. But when my test code runs using SQLite In-Memory, I get an exception: 'no such table: INFORMATION_SCHEMA.COLUMNS'

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, IList`1 entities, TableInfo tableInfo, OperationType operationType, Action`1 progress, CancellationToken cancellationToken)
   at MyCode.Repositories.UserRepository.<>c__DisplayClass5_0.<<Sync>b__0>d.MoveNext() in C:\projects\MyCode\Repositories\UserRepository.cs:line 48

INFORMATION_SCHEMA.COLUMNS isn't part of my data model and isn't something I'm trying to create or work with. Do I need to configure or tweak EF Core or SQLite to get it to support Bulk Operations when operation in-memory mode?

I've tried turning on EF core logging and can see my Db Model being processed and tables being created, but no output on the Bulk Operations, so I'm unsure what generated sql statements are looking for this Information_Schema.Columns table.

@ppittle
Copy link
Author

ppittle commented Mar 17, 2020

Fixed this by updating to 2.6.4.

Looks like it was fixed here: 32c80df#diff-2890413287118f31c41d64aca4a5970d

@ppittle ppittle closed this as completed Mar 17, 2020
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

1 participant